Description:
updated graded_at fields for graded submissions
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r387:d79d1e42bcbb - - 1 file changed: 1 inserted, 0 deleted
@@ -18,30 +18,31 | |||||
|
18 | if !problem |
|
18 | if !problem |
|
19 | puts "Problem not found" |
|
19 | puts "Problem not found" |
|
20 | exit(0) |
|
20 | exit(0) |
|
21 | end |
|
21 | end |
|
22 |
|
22 | ||
|
23 | problem.full_score = 100 |
|
23 | problem.full_score = 100 |
|
24 | problem.save |
|
24 | problem.save |
|
25 |
|
25 | ||
|
26 | test_pair = TestPair.get_for(problem, true) |
|
26 | test_pair = TestPair.get_for(problem, true) |
|
27 |
|
27 | ||
|
28 | User.all.each do |u| |
|
28 | User.all.each do |u| |
|
29 | puts "#{u.login}:" |
|
29 | puts "#{u.login}:" |
|
30 | submissions = Submission.find_all_by_user_problem(u.id, problem.id) |
|
30 | submissions = Submission.find_all_by_user_problem(u.id, problem.id) |
|
31 | submissions.each do |sub| |
|
31 | submissions.each do |sub| |
|
32 | result = test_pair.grade(sub.output) |
|
32 | result = test_pair.grade(sub.output) |
|
33 | result2 = test_pair.grade(sub.source) |
|
33 | result2 = test_pair.grade(sub.source) |
|
34 | if result2[:score] > result[:score] |
|
34 | if result2[:score] > result[:score] |
|
35 | result = result2 |
|
35 | result = result2 |
|
36 | puts "Use source field (#{sub.id})" |
|
36 | puts "Use source field (#{sub.id})" |
|
37 | end |
|
37 | end |
|
38 |
|
38 | ||
|
39 | full_score = result[:full_score] |
|
39 | full_score = result[:full_score] |
|
40 | sub.points = result[:score]*100 / full_score |
|
40 | sub.points = result[:score]*100 / full_score |
|
41 | sub.grader_comment = result[:msg] |
|
41 | sub.grader_comment = result[:msg] |
|
|
42 | + sub.graded_at = Time.now.gmtime | ||
|
42 | sub.save |
|
43 | sub.save |
|
43 | end |
|
44 | end |
|
44 | end |
|
45 | end |
|
45 | end |
|
46 | end |
|
46 |
|
47 | ||
|
47 | main |
|
48 | main |
You need to be logged in to leave comments.
Login now