|
|
|
|
@ -66,8 +66,8 @@ class CalendarFragment : RealmFragment(), CoroutineScope, StaticRowRepresentable |
|
|
|
|
private var sortedMonthlyReports: SortedMap<Date, ComputedResults> = HashMap<Date, ComputedResults>().toSortedMap() |
|
|
|
|
private var sortedYearlyReports: SortedMap<Date, ComputedResults> = HashMap<Date, ComputedResults>().toSortedMap() |
|
|
|
|
|
|
|
|
|
private val slidingMonthQuery = Query(QueryCondition.PastDay(30)) |
|
|
|
|
private val slidingYearQuery = Query(QueryCondition.PastDay(365)) |
|
|
|
|
private val slidingMonthQueryCondition = QueryCondition.PastDay(30) |
|
|
|
|
private val slidingYearQueryCondition = QueryCondition.PastDay(365) |
|
|
|
|
|
|
|
|
|
private var slidingMonthResults: ComputedResults? = null |
|
|
|
|
private var slidingYearResults: ComputedResults? = null |
|
|
|
|
@ -143,7 +143,7 @@ class CalendarFragment : RealmFragment(), CoroutineScope, StaticRowRepresentable |
|
|
|
|
when (position) { |
|
|
|
|
0 -> { |
|
|
|
|
this.slidingMonthResults?.let { |
|
|
|
|
showDetails(it, slidingMonthQuery.getName(requireContext())) |
|
|
|
|
showDetails(it, slidingMonthQueryCondition.getDisplayNameWithValues(requireContext())) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else -> { |
|
|
|
|
@ -158,7 +158,7 @@ class CalendarFragment : RealmFragment(), CoroutineScope, StaticRowRepresentable |
|
|
|
|
when (position) { |
|
|
|
|
0 -> { |
|
|
|
|
this.slidingYearResults?.let { |
|
|
|
|
showDetails(it, slidingYearQuery.getName(requireContext())) |
|
|
|
|
showDetails(it, slidingYearQueryCondition.getDisplayNameWithValues(requireContext())) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else -> { |
|
|
|
|
@ -350,6 +350,7 @@ class CalendarFragment : RealmFragment(), CoroutineScope, StaticRowRepresentable |
|
|
|
|
val allOptions = Calculator.Options( |
|
|
|
|
progressValues = Calculator.Options.ProgressValues.STANDARD, |
|
|
|
|
stats = requiredStats, |
|
|
|
|
query = Query(this.sessionTypeCondition) |
|
|
|
|
) |
|
|
|
|
val allReport = Calculator.computeStats(realm, options = allOptions) |
|
|
|
|
this.allComputedResults = allReport.results.first() |
|
|
|
|
@ -358,7 +359,7 @@ class CalendarFragment : RealmFragment(), CoroutineScope, StaticRowRepresentable |
|
|
|
|
val smOptions = Calculator.Options( |
|
|
|
|
progressValues = Calculator.Options.ProgressValues.STANDARD, |
|
|
|
|
stats = requiredStats, |
|
|
|
|
query = this.slidingMonthQuery |
|
|
|
|
query = Query(this.slidingMonthQueryCondition, this.sessionTypeCondition) |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
val smReport = Calculator.computeStats(realm, options = smOptions) |
|
|
|
|
@ -369,10 +370,7 @@ class CalendarFragment : RealmFragment(), CoroutineScope, StaticRowRepresentable |
|
|
|
|
|
|
|
|
|
val monthlyQueries = when (sessionTypeCondition) { |
|
|
|
|
QueryCondition.IsCash -> listOf(Criteria.AllMonthsUpToNow, Criteria.Cash).combined() |
|
|
|
|
QueryCondition.IsTournament -> listOf( |
|
|
|
|
Criteria.AllMonthsUpToNow, |
|
|
|
|
Criteria.Tournament |
|
|
|
|
).combined() |
|
|
|
|
QueryCondition.IsTournament -> listOf(Criteria.AllMonthsUpToNow, Criteria.Tournament).combined() |
|
|
|
|
else -> listOf(Criteria.Years, Criteria.MonthsOfYear).combined() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -408,7 +406,7 @@ class CalendarFragment : RealmFragment(), CoroutineScope, StaticRowRepresentable |
|
|
|
|
val syOptions = Calculator.Options( |
|
|
|
|
progressValues = Calculator.Options.ProgressValues.STANDARD, |
|
|
|
|
stats = requiredStats, |
|
|
|
|
query = this.slidingYearQuery |
|
|
|
|
query = Query(this.slidingYearQueryCondition, this.sessionTypeCondition) |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
val syReport = Calculator.computeStats(realm, options = syOptions) |
|
|
|
|
@ -501,7 +499,7 @@ class CalendarFragment : RealmFragment(), CoroutineScope, StaticRowRepresentable |
|
|
|
|
slidingMonthResults?.computedStat(this.currentStat)?.let { computedStat -> |
|
|
|
|
val row = CustomizableRowRepresentable( |
|
|
|
|
customViewType = RowViewType.TITLE_VALUE_ARROW, |
|
|
|
|
title = this.slidingMonthQuery.getName(requireContext()), |
|
|
|
|
title = this.slidingMonthQueryCondition.getDisplayNameWithValues(requireContext()), |
|
|
|
|
valueTextFormat = computedStat.textFormat, |
|
|
|
|
isSelectable = true |
|
|
|
|
) |
|
|
|
|
@ -541,7 +539,7 @@ class CalendarFragment : RealmFragment(), CoroutineScope, StaticRowRepresentable |
|
|
|
|
this.slidingYearResults?.computedStat(this.currentStat)?.let { computedStat -> |
|
|
|
|
val row = CustomizableRowRepresentable( |
|
|
|
|
customViewType = RowViewType.TITLE_VALUE_ARROW, |
|
|
|
|
title = this.slidingYearQuery.getName(requireContext()), |
|
|
|
|
title = this.slidingYearQueryCondition.getDisplayNameWithValues(requireContext()), |
|
|
|
|
valueTextFormat = computedStat.textFormat, |
|
|
|
|
isSelectable = true |
|
|
|
|
) |
|
|
|
|
|