LunaEvent: allow quantity of 0
This is helpful for storing an index
This commit is contained in:
@@ -45,9 +45,9 @@ class LunaEvent: Comparable<LunaEvent> {
|
||||
jo.put("type", value)
|
||||
}
|
||||
var quantity: Int
|
||||
get() = jo.optInt("quantity")
|
||||
get() = jo.optInt("quantity", -1)
|
||||
set(value) {
|
||||
if (value > 0)
|
||||
if (value >= 0)
|
||||
jo.put("quantity", value)
|
||||
}
|
||||
var notes: String
|
||||
|
||||
@@ -62,7 +62,7 @@ class NumericUtils (val context: Context) {
|
||||
|
||||
fun formatEventQuantity(event: LunaEvent): String {
|
||||
val formatted = StringBuilder()
|
||||
if (event.quantity > 0) {
|
||||
if (event.quantity >= 0) {
|
||||
formatted.append(when (event.type) {
|
||||
LunaEvent.TYPE_TEMPERATURE ->
|
||||
(event.quantity / 10.0f).toString()
|
||||
|
||||
Reference in New Issue
Block a user