Skip to content

Commit

Permalink
flag/attack chart start from first != 0 value (there was some situati…
Browse files Browse the repository at this point in the history
…ons it was not)
  • Loading branch information
domysh committed Nov 3, 2024
1 parent 5b70939 commit 102220c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions backend/models/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

from pydantic import BaseModel, AwareDatetime
from pydantic import BaseModel, model_validator
from pydantic import BaseModel, AwareDatetime, model_validator
from typing_extensions import Self
from functools import cache
from pydantic import NonNegativeInt, PositiveInt
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/charts/LineChartAttackView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const LineChartAttackView = ({ seriesType, attackType, chartType, withCon
const service_id = exploits.data?.find((exploit) => exploit.id == id)?.service
if (service_id == null) return
const oldValue = (!result[service_id] || typeof result[service_id] == "string")?0:result[service_id] as number
if (tick.exploits[id]?.attacks[finalAttackStatus] == null && initialSkip) return service_id
if ((tick.exploits[id]?.attacks[finalAttackStatus]??0) == 0 && initialSkip) return service_id
initialSkip = false
result[service_id] = tick.exploits[id]?.attacks[finalAttackStatus]??0 + oldValue
return service_id
Expand All @@ -82,7 +82,7 @@ export const LineChartAttackView = ({ seriesType, attackType, chartType, withCon
}
} else {
const ids_used = Object.keys(tick[finalSeries]).map((id) => {
if (tick[finalSeries][id]?.attacks[finalAttackStatus] == null && initialSkip) return id
if ((tick[finalSeries][id]?.attacks[finalAttackStatus]??0) == 0 && initialSkip) return id
initialSkip = false
result[id] = tick[finalSeries][id]?.attacks[finalAttackStatus]??0
return id
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/charts/LineChartFlagView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const LineChartFlagView = ({ seriesType, flagType, chartType, withControl
const service_id = exploits.data?.find((exploit) => exploit.id == id)?.service
if (service_id == null) return
const oldValue = (!result[service_id] || typeof result[service_id] == "string")?0:result[service_id] as number
if (tick.exploits[id]?.flags[finalFlagStatus] == null && initialSkip) return service_id
if ((tick.exploits[id]?.flags[finalFlagStatus]??0) == 0 && initialSkip) return service_id
initialSkip = false
result[service_id] = tick.exploits[id]?.flags[finalFlagStatus]??0 + oldValue
return service_id
Expand All @@ -82,7 +82,7 @@ export const LineChartFlagView = ({ seriesType, flagType, chartType, withControl
}
}else{
const used_ids = Object.keys(tick[finalSeries]).map((id) => {
if (tick[finalSeries][id]?.flags[finalFlagStatus] == null && initialSkip) return id
if ((tick[finalSeries][id]?.flags[finalFlagStatus]??0) == 0 && initialSkip) return id
initialSkip = false
result[id] = tick[finalSeries][id]?.flags[finalFlagStatus]??0
return id
Expand Down

0 comments on commit 102220c

Please sign in to comment.