update code to be mas fun
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user