Skip to content

Commit

Permalink
Bugfix Q1 (#562)
Browse files Browse the repository at this point in the history
* Remove Kontroll 115 and 120 from quarterly reporting
  • Loading branch information
jonolehagemo authored Apr 15, 2024
1 parent 712288a commit ff2709d
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 60 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ hs_err_pid*
# Intellij
.idea*
*.iml
/web-frontend/dist/
/web-frontend/node_modules/

# Node
dist/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ abstract class RegnskapValidator(
Rule080KombinasjonBevilgningFunksjonArt(),
Rule100SummeringDriftUtgiftsposteringer(),
Rule105SummeringDriftInntektsposteringer(),
Rule115SummeringBalanseAktiva(),
Rule120SummeringBalansePassiva(),
Rule130SkatteInntekter(),
Rule135Rammetilskudd(),
)
Expand All @@ -75,6 +73,8 @@ abstract class RegnskapValidator(
Rule090SummeringInvesteringInntektsposteringer(),
Rule095SummeringInvesteringDifferanse(),
Rule110SummeringDriftDifferanse(),
Rule115SummeringBalanseAktiva(),
Rule120SummeringBalansePassiva(),
Rule125SummeringBalanseDifferanse(),
Rule126SummeringDriftOsloInternDifferanse(),
Rule127SummeringInvesteringOsloInternDifferanse(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ class Rule115SummeringBalanseAktiva : AbstractRule<List<KostraRecord>>(
?.let { sumAktiva ->
createSingleReportEntryList(
messageText = "Korrigér slik at fila inneholder registrering av aktiva/eiendeler " +
"($sumAktiva), sum kapittel 10-29 i balanse.",
severity = if (arguments.kvartal.first() == ' ') Severity.ERROR else Severity.WARNING
"($sumAktiva), sum kapittel 10-29 i balanse."
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ class Rule120SummeringBalansePassiva : AbstractRule<List<KostraRecord>>(
?.let { sumPassiva ->
createSingleReportEntryList(
messageText = "Korrigér slik at fila inneholder registrering av passiva/gjeld og egenkapital " +
"($sumPassiva), sum kapittel 31-5990 i balanse.",
severity = if (arguments.kvartal.first() == ' ') Severity.ERROR else Severity.WARNING
"($sumPassiva), sum kapittel 31-5990 i balanse."
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ class KvartalKostraMainTest : BehaviorSpec({
}).plus(
mapOf(
"0AK1" to 1,
"0BK1" to 3,
"0BK1" to 2,
"0CK1" to 2,
"0DK1" to 3
"0DK1" to 2
).map { (skjema, expectedNumberOfControls) ->
row(
"skjema = $skjema, region = $region -> validating a valid record string",
Expand All @@ -69,9 +69,9 @@ class KvartalKostraMainTest : BehaviorSpec({
).plus(
mapOf(
"0AK1" to 2,
"0BK1" to 4,
"0BK1" to 3,
"0CK1" to 3,
"0DK1" to 4
"0DK1" to 3
).map { (skjema, expectedNumberOfControls) ->
row(
"skjema = $skjema, region = $region -> validating a valid record string with invalid data",
Expand Down Expand Up @@ -105,7 +105,7 @@ class KvartalKostraMainTest : BehaviorSpec({
companion object {
private val regions = setOf("123400", "030100", "040000")
private val validSkjemaTyper = setOf("0AK1", "0BK1", "0CK1", "0DK1")
private const val NUMBER_OF_VALIDATIONS = 34
private const val NUMBER_OF_VALIDATIONS = 32

private fun argumentsInTest(
argumentsVersion: String = RuleTestData.argumentsInTest.aargang,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ class Rule115SummeringBalanseAktivaTest : BehaviorSpec({
description = "0 < belop",
context = kostraRecordsInTest("420400", "0B", 2, 10, 1),
),
ForAllRowItem(
description = "isAktiva = false for quarterly reporting",
context = kostraRecordsInTest("420400", "0B", 2, 10, 0),
arguments = kostraArguments("1"),
expectedErrorMessage = "Korrigér slik at fila inneholder registrering av aktiva/eiendeler " +
"(0), sum kapittel 10-29 i balanse.",
expectedSeverity = Severity.WARNING
),
)
)
}) {
Expand All @@ -58,7 +50,5 @@ class Rule115SummeringBalanseAktivaTest : BehaviorSpec({
RegnskapConstants.FIELD_KAPITTEL to "$kapittel",
RegnskapConstants.FIELD_BELOP to "$belop"
).toKostraRecord(1, fieldDefinitions).asList()

private fun kostraArguments(kvartal: String) = argumentsInTest.copy(kvartal = kvartal)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ class Rule120SummeringBalansePassivaTest : BehaviorSpec({
description = "0 < belop",
context = kostraRecordsInTest("420400", "0B", 2, 31, -1),
),
ForAllRowItem(
description = "isPassiva = false for quarterly reporting",
context = kostraRecordsInTest("420400", "0B", 2, 31, 0),
arguments = kostraArguments("1"),
expectedErrorMessage = "Korrigér slik at fila inneholder registrering av passiva/gjeld og egenkapital " +
"(0), sum kapittel 31-5990 i balanse.",
expectedSeverity = Severity.WARNING
),
)
)
}) {
Expand All @@ -60,36 +52,5 @@ class Rule120SummeringBalansePassivaTest : BehaviorSpec({
RegnskapConstants.FIELD_KAPITTEL to "$kapittel",
FIELD_BELOP to "$belop"
).toKostraRecord(1, fieldDefinitions).asList()

private fun kostraArguments(kvartal: String) = argumentsInTest.copy(kvartal = kvartal)
}
}


// Given("context") {
// val sut = Rule120SummeringBalansePassiva()
//
// forAll(
// row("XX", "31 ", "1", false), // feil skjema
// row("0B", "10 ", "1", false), // feil kapittel
// row("0B", "31 ", "0", true), // feil belop
// row("0B", "31 ", "-1", false), // ok
// ) { skjema, kapittel, belop, expectError ->
// val kostraRecordList = mapOf(
// FIELD_SKJEMA to skjema,
// FIELD_FUNKSJON to kapittel,
// FIELD_BELOP to belop
// ).toKostraRecord(1, fieldDefinitions).asList()
//
// When("Activa is zero for $skjema, $kapittel, $belop") {
// verifyValidationResult(
// validationReportEntries = sut.validate(kostraRecordList, argumentsInTest),
// expectError = expectError,
// expectedSeverity = Severity.ERROR,
// "Korrigér slik at fila inneholder registrering av passiva/gjeld og egenkapital " +
// "($belop), sum kapittel 31-5990 i balanse."
// )
// }
// }
// }
//})

0 comments on commit ff2709d

Please sign in to comment.