diff --git a/app/src/main/kotlin/jackall/moncalc/db/QuestRecordRealmHelper.kt b/app/src/main/kotlin/jackall/moncalc/db/QuestRecordRealmHelper.kt index 62374d1..78ba960 100644 --- a/app/src/main/kotlin/jackall/moncalc/db/QuestRecordRealmHelper.kt +++ b/app/src/main/kotlin/jackall/moncalc/db/QuestRecordRealmHelper.kt @@ -43,11 +43,14 @@ return realm.where(QuestRecord::class.java).equalTo("templeId", id).findAll().size } - fun countGradeById(id: Int): Int { - val results = realm.where(QuestRecord::class.java).equalTo("drops.gradeId", id).findAll() + fun countGradeById(gradeId: Int): Int { + val results = realm.where(QuestRecord::class.java).equalTo("drops.gradeId", gradeId).findAll() var count = 0 results.forEach { - count += it.drops.size + it.drops.forEach { + if (it.gradeId == gradeId) + count++ + } } return count } @@ -60,7 +63,7 @@ var count = 0 results.forEach { it.drops.forEach { - if (it.fruitId == fruitId) + if (it.fruitId == fruitId && it.gradeId == gradeId) count++ } }