|
|
|
@ -45,13 +45,13 @@ enum class LiveData : Localizable { |
|
|
|
TOURNAMENT_FEATURE -> { |
|
|
|
TOURNAMENT_FEATURE -> { |
|
|
|
(countableUsage as CountableUsage).useCount = it.where<Session>().contains( |
|
|
|
(countableUsage as CountableUsage).useCount = it.where<Session>().contains( |
|
|
|
"tournamentFeatures.id", |
|
|
|
"tournamentFeatures.id", |
|
|
|
countableUsage.uniqueIdentifier() |
|
|
|
countableUsage.id |
|
|
|
).count().toInt() |
|
|
|
).count().toInt() |
|
|
|
} |
|
|
|
} |
|
|
|
else -> { |
|
|
|
else -> { |
|
|
|
(countableUsage as CountableUsage).useCount = it.where<Session>().equalTo( |
|
|
|
(countableUsage as CountableUsage).useCount = it.where<Session>().equalTo( |
|
|
|
"${relatedEntity.simpleName.decapitalize()}.id", |
|
|
|
"${relatedEntity.simpleName.decapitalize()}.id", |
|
|
|
countableUsage.uniqueIdentifier() |
|
|
|
countableUsage.id |
|
|
|
).count().toInt() |
|
|
|
).count().toInt() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -93,7 +93,7 @@ enum class LiveData : Localizable { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun deleteData(realm: Realm, data: Manageable) { |
|
|
|
fun deleteData(realm: Realm, data: Manageable) { |
|
|
|
realm.where(this.relatedEntity).equalTo("id", data.uniqueIdentifier()).findAll().deleteAllFromRealm() |
|
|
|
realm.where(this.relatedEntity).equalTo("id", data.id).findAll().deleteAllFromRealm() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun updateOrCreate(realm: Realm, primaryKey: String?): RealmObject { |
|
|
|
fun updateOrCreate(realm: Realm, primaryKey: String?): RealmObject { |
|
|
|
|