From 05b9ae094dbd781730158ce75f03aa26c74e69bf Mon Sep 17 00:00:00 2001 From: Laurent Date: Tue, 12 Feb 2019 16:53:19 +0100 Subject: [PATCH] add early logic of net computing on value setting --- .../android/model/realm/Result.kt | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app/src/main/java/net/pokeranalytics/android/model/realm/Result.kt b/app/src/main/java/net/pokeranalytics/android/model/realm/Result.kt index 8c049138..f0fa0f89 100644 --- a/app/src/main/java/net/pokeranalytics/android/model/realm/Result.kt +++ b/app/src/main/java/net/pokeranalytics/android/model/realm/Result.kt @@ -16,21 +16,42 @@ open class Result : RealmObject() { // The buyin amount var buyin: Double? = null + set(value) { + field = value + this.computeNet() + } // the cashed out amount var cashout: Double? = null + set(value) { + field = value + this.computeNet() + } // The net result var netResult: Double? = null + set(value) { + field = value + this.computeNet() + } // The net (readonly) var net: Double? = null // The transactions associated with the Result, impacting the result var transactions: RealmList = RealmList() + set(value) { + field = value + this.computeNet() + } // The tournament final position, if applicable var tournamentFinalPosition: Int? = null + // Computes the Net + fun computeNet() { +// this.net = ... + } + // @todo tips? } \ No newline at end of file