Merge pull request #687 from kiwix/675-systematic-crash-at-start-after-update-to-33

Fix default language when there's downloaded content already
This commit is contained in:
Kelson 2024-03-09 07:12:29 +01:00 committed by GitHub
commit 529d418015
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -150,6 +150,9 @@ class Languages {
count.expressionResultType = .integer16AttributeType
let fetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: "ZimFile")
// exclude the already downloaded files, they might have invalid language set
// but we are mainly interested in fetched content
fetchRequest.predicate = ZimFile.Predicate.notDownloaded
fetchRequest.propertiesToFetch = ["languageCode", count]
fetchRequest.propertiesToGroupBy = ["languageCode"]
fetchRequest.resultType = .dictionaryResultType