From 53fea983a90447865c429c2573bfb36cba179054 Mon Sep 17 00:00:00 2001 From: "gasperfele@fri1.uni-lj.si" Date: Wed, 1 Apr 2015 20:32:28 +0000 Subject: added hints to task results git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@296 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414 --- kpov_judge/tasks/copy_rename_100_files/task.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'kpov_judge/tasks/copy_rename_100_files') 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 -- cgit v1.2.1