diff --git a/app/src/main/kotlin/jackall/moncalc/db/QuestRecordRealmHelper.kt b/app/src/main/kotlin/jackall/moncalc/db/QuestRecordRealmHelper.kt index a19eab0..2a206a8 100644 --- a/app/src/main/kotlin/jackall/moncalc/db/QuestRecordRealmHelper.kt +++ b/app/src/main/kotlin/jackall/moncalc/db/QuestRecordRealmHelper.kt @@ -84,6 +84,16 @@ return realm.where(QuestRecord::class.java).greaterThan("createAt", yesterday.time).findAll().count() } + fun getTodayExtraCount(): Int { + val yesterday = Calendar.getInstance().apply { add(Calendar.DATE, -1) } + return realm.where(QuestRecord::class.java).greaterThan("createAt", yesterday.time).equalTo("extra", true).findAll().count() + } + + fun getTodayWakurinCount(): Int { + val yesterday = Calendar.getInstance().apply { add(Calendar.DATE, -1) } + return realm.where(QuestRecord::class.java).greaterThan("createAt", yesterday.time).sum("wakurin").toInt() + } + fun getTodaySpecialCount(): Int { val yesterday = Calendar.getInstance().apply { add(Calendar.DATE, -1) } val results = realm.where(QuestRecord::class.java).greaterThan("createAt", yesterday.time).greaterThan("drops.gradeId", 2).findAll() @@ -107,6 +117,16 @@ return realm.where(QuestRecord::class.java).greaterThan("createAt", weekAgo.time).findAll().count() } + fun getWeekExtraCount(): Int { + val yesterday = Calendar.getInstance().apply { add(Calendar.DATE, -7) } + return realm.where(QuestRecord::class.java).greaterThan("createAt", yesterday.time).equalTo("extra", true).findAll().count() + } + + fun getWeekWakurinCount(): Int { + val yesterday = Calendar.getInstance().apply { add(Calendar.DATE, -7) } + return realm.where(QuestRecord::class.java).greaterThan("createAt", yesterday.time).sum("wakurin").toInt() + } + fun getWeekSpecialCount(): Int { val weekAgo = Calendar.getInstance().apply { add(Calendar.DATE, -7) } val results = realm.where(QuestRecord::class.java).greaterThan("createAt", weekAgo.time).greaterThan("drops.gradeId", 2).findAll()