From f328261ea29b43235c661279745fa6451e20cee8 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sat, 4 Nov 2023 09:32:37 +0100 Subject: [PATCH] repochecker: Fix number of detected choices with step attribute --- admin/sync/exercice_keys.go | 1 - repochecker/epita/flags.go | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/admin/sync/exercice_keys.go b/admin/sync/exercice_keys.go index 2bafab41..f9a4373d 100644 --- a/admin/sync/exercice_keys.go +++ b/admin/sync/exercice_keys.go @@ -286,7 +286,6 @@ func iface2Number(input interface{}, output *string) error { *output = fmt.Sprintf("%d", v) } else if v, ok := input.(float64); ok { *output = strconv.FormatFloat(v, 'f', -1, 64) - fmt.Printf("%s\n", *output) } else { return fmt.Errorf("has an invalid type: expected int or float, got %T", input) } diff --git a/repochecker/epita/flags.go b/repochecker/epita/flags.go index 6c0d0ec8..ee192eb9 100644 --- a/repochecker/epita/flags.go +++ b/repochecker/epita/flags.go @@ -39,7 +39,7 @@ func EPITACheckKeyFlag(flag *fic.FlagKey, raw string, _ *fic.Exercice, exception errs = append(errs, err) } else if min == nil || max == nil || step == nil { errs = append(errs, fmt.Errorf("please define min and max for your number flag")) - } else if (*max-*min)**step <= 10 { + } else if (*max-*min) / *step <= 10 { errs = append(errs, fmt.Errorf("to avoid bruteforce, define more than 10 possibilities")) } }