@@ -43,17 +43,22 @@ class BestillingService(
43
43
fun hentBestilling (bestillingId : UUID ): BestillingResponse = transaction {
44
44
val bestilling = bestillingRepository.findByBestillingId(bestillingId)
45
45
? : throw BestillingIkkeFunnetException (" Bestilling ikke funnet" )
46
- val totalCount = bestiltVarselRepository.countByBestillingId(bestillingId)
47
- val sendtCount = bestiltVarselRepository.countByBestillingIdAndStatus(bestillingId, BestiltVarselStatus .SENDT )
48
- val feiletCount = bestiltVarselRepository.countByBestillingIdAndStatus(bestillingId, BestiltVarselStatus .FEILET )
49
- bestilling.asResponse(totalCount, sendtCount, feiletCount)
46
+ val totalCount = bestiltVarselRepository
47
+ .countByBestillingId(bestillingId)
48
+ val sendtCount = bestiltVarselRepository
49
+ .countByBestillingIdAndStatus(bestillingId, BestiltVarselStatus .SENDT )
50
+ val feiletCount = bestiltVarselRepository
51
+ .countByBestillingIdAndStatus(bestillingId, BestiltVarselStatus .FEILET )
52
+ val ignorertCount = bestiltVarselRepository
53
+ .countByBestillingIdAndStatus(bestillingId, BestiltVarselStatus .IGNORERT )
54
+ bestilling.asResponse(totalCount, sendtCount, feiletCount, ignorertCount)
50
55
}
51
56
52
57
@WithSpan(" opprettBestilling" )
53
58
fun opprettBestilling (bestiller : String ): BestillingResponse = transaction {
54
59
val bestillingId = UUID .randomUUID()
55
60
bestillingRepository.insert(InsertBestillingRow (bestillingId, bestiller))
56
- bestillingRepository.findByBestillingId(bestillingId)?.asResponse(0 , 0 , 0 )
61
+ bestillingRepository.findByBestillingId(bestillingId)?.asResponse(0 , 0 , 0 , 0 )
57
62
? : throw BestillingIkkeFunnetException (" Bestilling ikke funnet" )
58
63
}
59
64
@@ -120,7 +125,7 @@ class BestillingService(
120
125
val varsel = bestiltVarselRepository.findByVarselId(varselId)
121
126
? : throw VarselIkkeFunnetException (" Manuelt varsel ikke funnet" )
122
127
try {
123
- logger.debug (" Prosesserer manuelt varsel {}" , varselId)
128
+ logger.info (" Prosesserer manuelt varsel {}" , varselId)
124
129
if (applicationConfig.manuelleVarslerEnabled) {
125
130
val insertVarselRow = varsel.asInsertVarselRow()
126
131
varselRepository.insert(insertVarselRow)
@@ -138,7 +143,7 @@ class BestillingService(
138
143
)
139
144
}
140
145
} catch (e: Exception ) {
141
- logger.debug (" Sending av manuelt varsel feilet" , e)
146
+ logger.error (" Sending av manuelt varsel feilet" , e)
142
147
bestiltVarselRepository.update(UpdateBestiltVarselRow (varsel.varselId, BestiltVarselStatus .FEILET ))
143
148
}
144
149
bestiltVarselRepository.findByVarselId(varsel.varselId)
0 commit comments