Skip to content

Commit

Permalink
Checking CIVersion at start
Browse files Browse the repository at this point in the history
Signed-off-by: JanhaviAlekar <janhavialekar@gmail.com>
  • Loading branch information
JanhaviAlekar committed Jun 18, 2024
1 parent b67b173 commit b0b0b5a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions chaoscenter/graphql/server/pkg/chaos_infrastructure/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -908,16 +908,17 @@ func fetchLatestVersion(versions map[int]string) int {

// updateVersionFormat converts string array to int by removing decimal points, 1.0.0 will be returned as 100, 0.1.0 will be returned as 10, 0.0.1 will be returned as 1
func updateVersionFormat(str string) (int, error) {
if str == CIVersion {
return 0, nil
}
var versionInt int
versionSlice := strings.Split(str, ".")
for i, val := range versionSlice {
if val != CIVersion {
x, err := strconv.Atoi(val)
if err != nil {
return -1, err
}
versionInt += x * int(math.Pow(10, float64(2-i)))
x, err := strconv.Atoi(val)
if err != nil {
return -1, err
}
versionInt += x * int(math.Pow(10, float64(2-i)))
}
return versionInt, nil
}
Expand Down

0 comments on commit b0b0b5a

Please sign in to comment.