|
|
|
@ -91,6 +91,10 @@ class CalendarFragment : SessionObserverFragment(), CoroutineScope, StaticRowRep |
|
|
|
return rows |
|
|
|
return rows |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onRowSelected(position: Int, row: RowRepresentable, fromAction: Boolean) { |
|
|
|
|
|
|
|
//toast("Open $row") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Business |
|
|
|
// Business |
|
|
|
|
|
|
|
|
|
|
|
@ -268,10 +272,10 @@ class CalendarFragment : SessionObserverFragment(), CoroutineScope, StaticRowRep |
|
|
|
sortedMonthlyReports = monthlyReports.toSortedMap(compareByDescending { it }) |
|
|
|
sortedMonthlyReports = monthlyReports.toSortedMap(compareByDescending { it }) |
|
|
|
sortedYearlyReports = yearlyReports.toSortedMap(compareByDescending { it }) |
|
|
|
sortedYearlyReports = yearlyReports.toSortedMap(compareByDescending { it }) |
|
|
|
|
|
|
|
|
|
|
|
// Logs |
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
Timber.d("Computation: ${System.currentTimeMillis() - startDate.time}ms") |
|
|
|
Timber.d("Computation: ${System.currentTimeMillis() - startDate.time}ms") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Logs |
|
|
|
|
|
|
|
/* |
|
|
|
Timber.d("========== YEAR x MONTH") |
|
|
|
Timber.d("========== YEAR x MONTH") |
|
|
|
sortedMonthlyReports.keys.forEach { |
|
|
|
sortedMonthlyReports.keys.forEach { |
|
|
|
Timber.d("$it => ${sortedMonthlyReports[it]?.computedStat(Stat.NETRESULT)?.value}") |
|
|
|
Timber.d("$it => ${sortedMonthlyReports[it]?.computedStat(Stat.NETRESULT)?.value}") |
|
|
|
@ -286,9 +290,7 @@ class CalendarFragment : SessionObserverFragment(), CoroutineScope, StaticRowRep |
|
|
|
GlobalScope.launch(Dispatchers.Main) { |
|
|
|
GlobalScope.launch(Dispatchers.Main) { |
|
|
|
displayData() |
|
|
|
displayData() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -304,9 +306,7 @@ class CalendarFragment : SessionObserverFragment(), CoroutineScope, StaticRowRep |
|
|
|
|
|
|
|
|
|
|
|
// Create monthly reports |
|
|
|
// Create monthly reports |
|
|
|
TimeFilter.MONTH -> { |
|
|
|
TimeFilter.MONTH -> { |
|
|
|
|
|
|
|
|
|
|
|
val years: ArrayList<String> = ArrayList() |
|
|
|
val years: ArrayList<String> = ArrayList() |
|
|
|
|
|
|
|
|
|
|
|
sortedMonthlyReports.keys.forEach { date -> |
|
|
|
sortedMonthlyReports.keys.forEach { date -> |
|
|
|
if (!years.contains(date.getDateYear())) { |
|
|
|
if (!years.contains(date.getDateYear())) { |
|
|
|
years.add(date.getDateYear()) |
|
|
|
years.add(date.getDateYear()) |
|
|
|
@ -323,7 +323,8 @@ class CalendarFragment : SessionObserverFragment(), CoroutineScope, StaticRowRep |
|
|
|
CustomizableRowRepresentable( |
|
|
|
CustomizableRowRepresentable( |
|
|
|
customViewType = RowViewType.TITLE_VALUE_ARROW, |
|
|
|
customViewType = RowViewType.TITLE_VALUE_ARROW, |
|
|
|
title = date.getDateMonth(), |
|
|
|
title = date.getDateMonth(), |
|
|
|
computedStat = computedStat |
|
|
|
computedStat = computedStat, |
|
|
|
|
|
|
|
isSelectable = true |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
@ -332,21 +333,19 @@ class CalendarFragment : SessionObserverFragment(), CoroutineScope, StaticRowRep |
|
|
|
|
|
|
|
|
|
|
|
// Create yearly reports |
|
|
|
// Create yearly reports |
|
|
|
TimeFilter.YEAR -> { |
|
|
|
TimeFilter.YEAR -> { |
|
|
|
|
|
|
|
|
|
|
|
sortedYearlyReports.keys.forEach { date -> |
|
|
|
sortedYearlyReports.keys.forEach { date -> |
|
|
|
Timber.d("$date => ${sortedYearlyReports[date]?.computedStat(Stat.NETRESULT)?.value}") |
|
|
|
|
|
|
|
sortedYearlyReports[date]?.computedStat(currentStat)?.let { computedStat -> |
|
|
|
sortedYearlyReports[date]?.computedStat(currentStat)?.let { computedStat -> |
|
|
|
rows.add( |
|
|
|
rows.add( |
|
|
|
CustomizableRowRepresentable( |
|
|
|
CustomizableRowRepresentable( |
|
|
|
customViewType = RowViewType.TITLE_VALUE_ARROW, |
|
|
|
customViewType = RowViewType.TITLE_VALUE_ARROW, |
|
|
|
title = date.getDateYear(), |
|
|
|
title = date.getDateYear(), |
|
|
|
computedStat = computedStat |
|
|
|
computedStat = computedStat, |
|
|
|
|
|
|
|
isSelectable = true |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Timber.d("Display data: ${System.currentTimeMillis() - startDate.time}ms") |
|
|
|
Timber.d("Display data: ${System.currentTimeMillis() - startDate.time}ms") |
|
|
|
|