Cleanup saved search copy debug function
This commit is contained in:
parent
8ec3d9565e
commit
b4e39448fc
@ -228,10 +228,10 @@ object DebugFunctions {
|
|||||||
val filterSerializer = FilterSerializer()
|
val filterSerializer = FilterSerializer()
|
||||||
val source = sourceManager.getOrStub(EH_SOURCE_ID) as CatalogueSource
|
val source = sourceManager.getOrStub(EH_SOURCE_ID) as CatalogueSource
|
||||||
val newSource = sourceManager.getOrStub(EXH_SOURCE_ID) as CatalogueSource
|
val newSource = sourceManager.getOrStub(EXH_SOURCE_ID) as CatalogueSource
|
||||||
val savedSearches = prefs.eh_savedSearches().get().map {
|
val savedSearches = prefs.eh_savedSearches().get().mapNotNull {
|
||||||
try {
|
try {
|
||||||
val id = it.substringBefore(':').toLong()
|
val id = it.substringBefore(':').toLong()
|
||||||
if (id != source.id) return@map null
|
if (id != source.id) return@mapNotNull null
|
||||||
val content = JsonParser.parseString(it.substringAfter(':')).obj
|
val content = JsonParser.parseString(it.substringAfter(':')).obj
|
||||||
|
|
||||||
val originalFilters = source.getFilterList()
|
val originalFilters = source.getFilterList()
|
||||||
@ -247,11 +247,11 @@ object DebugFunctions {
|
|||||||
t.printStackTrace()
|
t.printStackTrace()
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
}.filterNotNull().toMutableList()
|
}.toMutableList()
|
||||||
savedSearches += prefs.eh_savedSearches().get().map {
|
savedSearches += prefs.eh_savedSearches().get().mapNotNull {
|
||||||
try {
|
try {
|
||||||
val id = it.substringBefore(':').toLong()
|
val id = it.substringBefore(':').toLong()
|
||||||
if (id != newSource.id) return@map null
|
if (id != newSource.id) return@mapNotNull null
|
||||||
val content = JsonParser.parseString(it.substringAfter(':')).obj
|
val content = JsonParser.parseString(it.substringAfter(':')).obj
|
||||||
|
|
||||||
val originalFilters = source.getFilterList()
|
val originalFilters = source.getFilterList()
|
||||||
@ -267,7 +267,7 @@ object DebugFunctions {
|
|||||||
t.printStackTrace()
|
t.printStackTrace()
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
}.filterNotNull().filterNot { newSavedSearch -> savedSearches.any { it.name == newSavedSearch.name } }
|
}.filterNot { newSavedSearch -> savedSearches.any { it.name == newSavedSearch.name } }
|
||||||
|
|
||||||
val otherSerialized = prefs.eh_savedSearches().get().filter {
|
val otherSerialized = prefs.eh_savedSearches().get().filter {
|
||||||
!it.startsWith("${newSource.id}:")
|
!it.startsWith("${newSource.id}:")
|
||||||
@ -288,10 +288,10 @@ object DebugFunctions {
|
|||||||
val filterSerializer = FilterSerializer()
|
val filterSerializer = FilterSerializer()
|
||||||
val source = sourceManager.getOrStub(EXH_SOURCE_ID) as CatalogueSource
|
val source = sourceManager.getOrStub(EXH_SOURCE_ID) as CatalogueSource
|
||||||
val newSource = sourceManager.getOrStub(EH_SOURCE_ID) as CatalogueSource
|
val newSource = sourceManager.getOrStub(EH_SOURCE_ID) as CatalogueSource
|
||||||
val savedSearches = prefs.eh_savedSearches().get().map {
|
val savedSearches = prefs.eh_savedSearches().get().mapNotNull {
|
||||||
try {
|
try {
|
||||||
val id = it.substringBefore(':').toLong()
|
val id = it.substringBefore(':').toLong()
|
||||||
if (id != source.id) return@map null
|
if (id != source.id) return@mapNotNull null
|
||||||
val content = JsonParser.parseString(it.substringAfter(':')).obj
|
val content = JsonParser.parseString(it.substringAfter(':')).obj
|
||||||
|
|
||||||
val originalFilters = source.getFilterList()
|
val originalFilters = source.getFilterList()
|
||||||
@ -307,11 +307,11 @@ object DebugFunctions {
|
|||||||
t.printStackTrace()
|
t.printStackTrace()
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
}.filterNotNull().toMutableList()
|
}.toMutableList()
|
||||||
savedSearches += prefs.eh_savedSearches().get().map {
|
savedSearches += prefs.eh_savedSearches().get().mapNotNull {
|
||||||
try {
|
try {
|
||||||
val id = it.substringBefore(':').toLong()
|
val id = it.substringBefore(':').toLong()
|
||||||
if (id != newSource.id) return@map null
|
if (id != newSource.id) return@mapNotNull null
|
||||||
val content = JsonParser.parseString(it.substringAfter(':')).obj
|
val content = JsonParser.parseString(it.substringAfter(':')).obj
|
||||||
|
|
||||||
val originalFilters = source.getFilterList()
|
val originalFilters = source.getFilterList()
|
||||||
@ -327,7 +327,7 @@ object DebugFunctions {
|
|||||||
t.printStackTrace()
|
t.printStackTrace()
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
}.filterNotNull().filterNot { newSavedSearch -> savedSearches.any { it.name == newSavedSearch.name } }
|
}.filterNot { newSavedSearch -> savedSearches.any { it.name == newSavedSearch.name } }
|
||||||
|
|
||||||
val otherSerialized = prefs.eh_savedSearches().get().filter {
|
val otherSerialized = prefs.eh_savedSearches().get().filter {
|
||||||
!it.startsWith("${newSource.id}:")
|
!it.startsWith("${newSource.id}:")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user