|
|
|
|
@ -279,6 +279,8 @@ class SessionFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRepr |
|
|
|
|
session.updateValue(value, row) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Timber.d("val = ${this.currentSession.customFieldEntries}") |
|
|
|
|
|
|
|
|
|
// try { |
|
|
|
|
// this.currentSession.updateValue(value, row) |
|
|
|
|
// getRealm().executeTransactionAsync { realm -> |
|
|
|
|
@ -312,6 +314,10 @@ class SessionFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRepr |
|
|
|
|
getRealm().executeTransactionAsync { realm -> |
|
|
|
|
val session = realm.copyToRealmOrUpdate(this.currentSession) |
|
|
|
|
session.preCompute() |
|
|
|
|
|
|
|
|
|
for (customField in this.model.customFields) { |
|
|
|
|
realm.copyToRealmOrUpdate(customField) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -703,15 +709,16 @@ class SessionFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRepr |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
is CustomField -> { |
|
|
|
|
val entry = row.entries.intersect(session.customFieldEntries).firstOrNull() |
|
|
|
|
row.editingDescriptors( |
|
|
|
|
when (row.type) { |
|
|
|
|
CustomField.Type.LIST.uniqueIdentifier -> mapOf( |
|
|
|
|
"defaultValue" to session.customFieldEntries.find { it.customField?.id == row.id }?.value, |
|
|
|
|
"data" to row.entries |
|
|
|
|
) |
|
|
|
|
else -> mapOf( |
|
|
|
|
"defaultValue" to session.customFieldEntries.find { it.customField?.id == row.id }?.numericValue |
|
|
|
|
) |
|
|
|
|
CustomField.Type.LIST.uniqueIdentifier -> { |
|
|
|
|
mapOf( |
|
|
|
|
"defaultValue" to entry?.value, |
|
|
|
|
"data" to row.entries |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
else -> mapOf("defaultValue" to entry?.numericValue) |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
@ -721,19 +728,17 @@ class SessionFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRepr |
|
|
|
|
|
|
|
|
|
override fun resultCaptureTypeSelected(resultCaptureType: ResultCaptureType, applyBankroll: Boolean) { |
|
|
|
|
|
|
|
|
|
when (resultCaptureType) { |
|
|
|
|
ResultCaptureType.NET_RESULT -> { |
|
|
|
|
this.currentSession.clearBuyinCashedOut() |
|
|
|
|
} |
|
|
|
|
ResultCaptureType.BUYIN_CASHED_OUT -> { |
|
|
|
|
this.currentSession.clearNetResult() |
|
|
|
|
updateSessionThenSaveAsynchronously { |
|
|
|
|
when (resultCaptureType) { |
|
|
|
|
ResultCaptureType.NET_RESULT -> { |
|
|
|
|
this.currentSession.clearBuyinCashedOut() |
|
|
|
|
} |
|
|
|
|
ResultCaptureType.BUYIN_CASHED_OUT -> { |
|
|
|
|
this.currentSession.clearNetResult() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getRealm().executeTransactionAsync { asyncRealm -> // cleanup existing results |
|
|
|
|
asyncRealm.copyToRealmOrUpdate(this.currentSession) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.model.resultCaptureType = resultCaptureType |
|
|
|
|
if (applyBankroll) { |
|
|
|
|
this.currentSession.bankroll?.let { bankroll -> |
|
|
|
|
|