From 185ae803ded66f141afd48e5b4f672b51b153f66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ron=20Nosz=C3=A1ly?= Date: Thu, 2 May 2024 15:53:12 +0200 Subject: [PATCH] task_yaml: accept float scores in score_type_parameters --- pkg/problems/config/task_yaml/task_yaml.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/problems/config/task_yaml/task_yaml.go b/pkg/problems/config/task_yaml/task_yaml.go index 83dde475..6ad54e04 100644 --- a/pkg/problems/config/task_yaml/task_yaml.go +++ b/pkg/problems/config/task_yaml/task_yaml.go @@ -211,7 +211,15 @@ func (p Problem) StatusSkeleton(name string) (*problems.Status, error) { if len(testsLeft) == 1 { if !isSum { - tc.MaxScore = float64(p.ScoreTypeParameters[subtask][0].(int)) + v := p.ScoreTypeParameters[subtask][0] + switch v.(type) { + case float64: + tc.MaxScore = v.(float64) + case int: + tc.MaxScore = float64(v.(int)) + default: + return nil, errors.New("task_yaml: wrong score format") + } } subtask++ testsLeft = testsLeft[1:]