update code to be mas fun

This commit is contained in:
Trey t
2022-02-03 15:32:58 -06:00
parent 374d2bd954
commit b3aa0d8e32

View File

@@ -18,15 +18,11 @@ class ContentModeViewModel: ObservableObject {
} }
private var numberOfEntries: Int { private var numberOfEntries: Int {
var num = 0 grouped.keys.map{
grouped.keys.forEach({ grouped[$0]!.values.reduce(0) { sum, array in
let year = grouped[$0] sum + array.count
let monthKeys = year?.keys }
monthKeys?.forEach({ }.reduce(0, +)
num += year![$0]!.count
})
})
return num
} }
init() { init() {
@@ -40,6 +36,7 @@ class ContentModeViewModel: ObservableObject {
private func getGroupedData() { private func getGroupedData() {
grouped = PersistenceController.shared.splitIntoYearMonth() grouped = PersistenceController.shared.splitIntoYearMonth()
numberOfItems = numberOfEntries numberOfItems = numberOfEntries
print(numberOfItems)
} }
public func shouldShowVotingHeader() -> Bool { public func shouldShowVotingHeader() -> Bool {