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)
|
jo.put("type", value)
|
||||||
}
|
}
|
||||||
var quantity: Int
|
var quantity: Int
|
||||||
get() = jo.optInt("quantity")
|
get() = jo.optInt("quantity", -1)
|
||||||
set(value) {
|
set(value) {
|
||||||
if (value > 0)
|
if (value >= 0)
|
||||||
jo.put("quantity", value)
|
jo.put("quantity", value)
|
||||||
}
|
}
|
||||||
var notes: String
|
var notes: String
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class NumericUtils (val context: Context) {
|
|||||||
|
|
||||||
fun formatEventQuantity(event: LunaEvent): String {
|
fun formatEventQuantity(event: LunaEvent): String {
|
||||||
val formatted = StringBuilder()
|
val formatted = StringBuilder()
|
||||||
if (event.quantity > 0) {
|
if (event.quantity >= 0) {
|
||||||
formatted.append(when (event.type) {
|
formatted.append(when (event.type) {
|
||||||
LunaEvent.TYPE_TEMPERATURE ->
|
LunaEvent.TYPE_TEMPERATURE ->
|
||||||
(event.quantity / 10.0f).toString()
|
(event.quantity / 10.0f).toString()
|
||||||
|
|||||||
Reference in New Issue
Block a user