diff --git a/app/src/main/kotlin/jackall/moncalc/db/QuestRecordRealmHelper.kt b/app/src/main/kotlin/jackall/moncalc/db/QuestRecordRealmHelper.kt index e24377d..1ca4054 100644 --- a/app/src/main/kotlin/jackall/moncalc/db/QuestRecordRealmHelper.kt +++ b/app/src/main/kotlin/jackall/moncalc/db/QuestRecordRealmHelper.kt @@ -3,6 +3,7 @@ import io.realm.RealmResults import jackall.moncalc.vo.QuestRecord import java.util.* +import kotlin.collections.ArrayList /** * Created by matsumoto_k on 2017/11/03. @@ -124,4 +125,21 @@ val yesterday = Calendar.getInstance().apply { add(Calendar.DATE, -7) } return realm.where(QuestRecord::class.java).greaterThan("createAt", yesterday.time).sum("dropCount").toInt() } +// +// fun findByPeriod(period: Int): ArrayList { +// val startCalender = Calendar.getInstance() +// val endCalendar = Calendar.getInstance().apply { add(Calendar.DATE, -1) } +// val results = ArrayList() +// var count = 0 +// for (i in 0 until period) { +// count = realm.where(QuestRecord::class.java).between("createAt", endCalendar.time, startCalender.time).findAll().count() +// println(count) +// if (count > 0) { +// results.add(count) +// } +// startCalender.time = endCalendar.time +// endCalendar.apply { add(Calendar.DATE, -1) } +// } +// return results +// } } \ No newline at end of file