summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/copy_rename_100_files
diff options
context:
space:
mode:
Diffstat (limited to 'kpov_judge/tasks/copy_rename_100_files')
-rw-r--r--kpov_judge/tasks/copy_rename_100_files/task.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/kpov_judge/tasks/copy_rename_100_files/task.py b/kpov_judge/tasks/copy_rename_100_files/task.py
index ff82956..1b8326b 100644
--- a/kpov_judge/tasks/copy_rename_100_files/task.py
+++ b/kpov_judge/tasks/copy_rename_100_files/task.py
@@ -89,16 +89,24 @@ def task_check(results, params):
import os
score = 0
-
+ hints = []
matched = 0
files = os.listdir(params['folder'])
for fn in files:
if fn in results['files']:
matched += 1
- score += matched > 0
- score += 2 * (matched > len(files)/2)
- score += 3 * (matched == len(files))
-
+ if matched > 0:
+ score = 1
+ else:
+ hints += ["no files"]
+ if matched > len(files)/2:
+ score += 2
+ else:
+ hints += ["less than half the files"]
+ if (matched == len(files)):
+ score += 3
+ else:
+ hints += ["wrong number of files"]
rl = results['contents'].split('\n')
rl.sort()
tl = []
@@ -106,9 +114,11 @@ def task_check(results, params):
with open(fn) as f:
tl += f.read().upper().split('\n')
tl.sort()
- score += 4 * (rl == tl)
-
- return score
+ if rl == tl:
+ score += 4
+ else:
+ hints += ["wrong files"]
+ return hints, score
def prepare_disks(templates, params):
pass