Skip to content

Commit

Permalink
fix sonarcloud warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo <[email protected]>
  • Loading branch information
Balcan authored and andresmr committed Nov 13, 2024
1 parent a49d92c commit 7d080b2
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ class TroubleshootingRepository(
.blockingGet().toRuleVariableList(
d2.trackedEntityModule().trackedEntityAttributes(),
d2.dataElementModule().dataElements(),
d2.optionModule().options(),
).mapNotNull {
val ruleValueType = it.fieldType
val valueKey = when (it) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ fun List<ProgramRuleAction>.toRuleActionList(): List<RuleAction> {
fun List<ProgramRuleVariable>.toRuleVariableList(
attributeRepository: TrackedEntityAttributeCollectionRepository,
dataElementRepository: DataElementCollectionRepository,
optionRepository: OptionCollectionRepository,
): List<RuleVariable> {
return mapNotNull {
val allowVariable = when {
Expand All @@ -76,7 +75,7 @@ fun List<ProgramRuleVariable>.toRuleVariableList(
else -> isCalculatedValue(it)
}
if (allowVariable) {
it.toRuleVariable(attributeRepository, dataElementRepository, optionRepository)
it.toRuleVariable(attributeRepository, dataElementRepository)
} else {
null
}
Expand Down Expand Up @@ -328,7 +327,6 @@ fun ProgramRuleAction.toRuleEngineObject(): RuleAction {
fun ProgramRuleVariable.toRuleVariable(
attributeRepository: TrackedEntityAttributeCollectionRepository,
dataElementRepository: DataElementCollectionRepository,
optionRepository: OptionCollectionRepository,
): RuleVariable {
val valueType = when (programRuleVariableSourceType()) {
ProgramRuleVariableSourceType.DATAELEMENT_NEWEST_EVENT_PROGRAM_STAGE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package org.dhis2.mobileProgramRules

import android.os.Build
import android.text.TextUtils.isEmpty
import io.reactivex.Single
import kotlinx.datetime.Instant
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toLocalDateTime
Expand Down Expand Up @@ -69,23 +68,9 @@ class RulesRepository(private val d2: D2) {
.toRuleVariableList(
d2.trackedEntityModule().trackedEntityAttributes(),
d2.dataElementModule().dataElements(),
d2.optionModule().options(),
)
}

fun ruleVariablesProgramStages(programUid: String): Single<List<RuleVariable>> {
return d2.programModule().programRuleVariables().byProgramUid().eq(programUid).get()
.toFlowable().flatMapIterable { list -> list }
.map {
it.toRuleVariable(
d2.trackedEntityModule().trackedEntityAttributes(),
d2.dataElementModule().dataElements(),
d2.optionModule().options(),
)
}
.toList()
}

suspend fun constants(): Map<String, String> {
return d2.constantModule().constants().blockingGet()
.associate { constant ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ class RuleValidationHelperImpl @Inject constructor(
it.toRuleVariableList(
d2.trackedEntityModule().trackedEntityAttributes(),
d2.dataElementModule().dataElements(),
d2.optionModule().options(),
)
}
}
Expand Down

0 comments on commit 7d080b2

Please sign in to comment.