fix instance objects
This commit is contained in:
parent
a0ba813d5f
commit
c10484f698
2 changed files with 3 additions and 3 deletions
|
@ -24,7 +24,7 @@ data class Instance(
|
||||||
* at least I think because it's recent and unavailable machines don't have that */
|
* at least I think because it's recent and unavailable machines don't have that */
|
||||||
val startDate: Long,
|
val startDate: Long,
|
||||||
/** when instance will expire as unix seconds, like 1861891577 */
|
/** when instance will expire as unix seconds, like 1861891577 */
|
||||||
val endDate: Long
|
val endDate: Long?
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
fun fromJson(json: JSONObject): Instance {
|
fun fromJson(json: JSONObject): Instance {
|
||||||
|
@ -36,7 +36,7 @@ data class Instance(
|
||||||
json.getInt("num_gpus"),
|
json.getInt("num_gpus"),
|
||||||
json.getDouble("dlperf"),
|
json.getDouble("dlperf"),
|
||||||
json.getDouble("start_date").toLong(),
|
json.getDouble("start_date").toLong(),
|
||||||
json.getDouble("end_date").toLong()
|
json.optLong("end_date").takeIf { it > 0 }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ data class Machine(
|
||||||
json.getString("mobo_name"),
|
json.getString("mobo_name"),
|
||||||
json.getInt("cpu_ram"),
|
json.getInt("cpu_ram"),
|
||||||
json.getDouble("reliability2"),
|
json.getDouble("reliability2"),
|
||||||
HostingClass.entries.getOrElse(json.getInt("hostingType")) { HostingClass.PRIVATE },
|
HostingClass.entries.getOrElse(json.optInt("hosting_type", 0)) { HostingClass.PRIVATE },
|
||||||
MachineVerification.fromString(json.getString("verification"))
|
MachineVerification.fromString(json.getString("verification"))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue