Commit 8feb4126 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Order host sources by name (so that the sources first in the list contain the least duplicates)

parent 8280f21f
Pipeline #7306 passed with stage
in 3 minutes and 56 seconds
...@@ -48,7 +48,7 @@ interface HostSourceDao { ...@@ -48,7 +48,7 @@ interface HostSourceDao {
@Query("SELECT * FROM HostSource ORDER BY name COLLATE NOCASE ASC") @Query("SELECT * FROM HostSource ORDER BY name COLLATE NOCASE ASC")
fun getAll(): List<HostSource> fun getAll(): List<HostSource>
@Query("SELECT * FROM HostSource WHERE enabled > 0 ORDER BY whitelistSource DESC") @Query("SELECT * FROM HostSource WHERE enabled > 0 ORDER BY name ASC")
fun getAllEnabled(): List<HostSource> fun getAllEnabled(): List<HostSource>
@Query("SELECT COUNT(*) FROM HostSource") @Query("SELECT COUNT(*) FROM HostSource")
......
...@@ -97,9 +97,7 @@ class RuleImportService : IntentService("RuleImportService") { ...@@ -97,9 +97,7 @@ class RuleImportService : IntentService("RuleImportService") {
getDatabase().hostSourceDao().getAllEnabled().filter { getDatabase().hostSourceDao().getAllEnabled().filter {
it.id in ids it.id in ids
} }
} ?: getDatabase().hostSourceDao().getAllEnabled()).sortedByDescending { } ?: getDatabase().hostSourceDao().getAllEnabled()).sortedWith(compareBy({it.whitelistSource}, {it.name}))
it.whitelistSource // Process whitelist first
}
sourcesIds = sources.map { it.id } sourcesIds = sources.map { it.id }
startWork() startWork()
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment