fix rentedinstance object

This commit is contained in:
Minecon724 2024-08-01 14:25:59 +02:00
parent 0a85bb20e0
commit a48c19833b
Signed by: Minecon724
GPG key ID: 3CCC4D267742C8E8

View file

@ -50,17 +50,17 @@ data class RentedInstance(
Instance.fromJson(json), Instance.fromJson(json),
json.getDouble("disk_space"), json.getDouble("disk_space"),
json.getDouble("disk_util"), json.getDouble("disk_util"),
(StorageCapacityConverters.gibToGb(json.getDouble("vmem_usage")) / 1000).toInt(), (StorageCapacityConverters.gibToGb(json.optDouble("vmem_usage")) / 1000).toInt(),
(json.getDouble("mem_usage") / 1000).toInt(), (json.optDouble("mem_usage") / 1000).toInt(),
json.getDouble("gpu_util") / 100, json.optDouble("gpu_util") / 100,
json.getDouble("cpu_util") / 100, json.getDouble("cpu_util") / 100,
json.getDouble("gpu_temp"), json.optDouble("gpu_temp"),
json.getDouble("inet_down_billed").toInt(), json.optDouble("inet_down_billed").toInt(),
json.getDouble("inet_up_billed").toInt(), json.optDouble("inet_up_billed").toInt(),
json.getString("ssh_host"), json.getString("ssh_host"),
json.getInt("ssh_port"), json.getInt("ssh_port"),
json.getString("image_uuid"), json.getString("image_uuid"),
json.optString("label").takeIf { it.isNotBlank() }, json.optString("label").takeUnless { it == "null" || it.isBlank() },
json.getString("local_ipaddrs").split(" ").filterNot { it == "\n" } json.getString("local_ipaddrs").split(" ").filterNot { it == "\n" }
) )
} }