Skip to content

Commit

Permalink
fix: update nms to enable tests by default
Browse files Browse the repository at this point in the history
  • Loading branch information
aanorbel committed May 27, 2024
1 parent abfd9be commit a0ed22e
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,26 @@ class DefaultDescriptors {
val descriptorList: List<OONIRunDescriptor> =
Gson().fromJson(jsonReader, descriptorType)
// Save the descriptors to the database.
descriptorList.forEach {
descriptorList.forEach { ooniRunDescriptor ->

// Check if the descriptor is already in the database.
it.nettests.forEach { nettest ->
ooniRunDescriptor.nettests.forEach { nettest ->
nettest.inputs?.forEach { input ->
Url.checkExistingUrl(input)
}
}
// Check if the descriptor is already in the database.
val testDescriptor = SQLite.select().from(TestDescriptor::class.java)
.where(TestDescriptor_Table.runId.eq(it.oonirunLinkId.toLong()))
.where(TestDescriptor_Table.runId.eq(ooniRunDescriptor.oonirunLinkId.toLong()))
.querySingle()
// Save the descriptor if it is not in the database.
if (testDescriptor == null) {
it.toTestDescriptor().apply {
ooniRunDescriptor.toTestDescriptor().apply {

ooniRunDescriptor.nettests.forEach { nettest ->
(context as? Application)?.preferenceManager?.enableTest(nettest.name, preferencePrefix())
}

isAutoUpdate = true
isAutoRun = true
}.save()
Expand Down

0 comments on commit a0ed22e

Please sign in to comment.