Description:
fixed timeout bug for wrong submission (thanks to @dtinth), and js bugs occurring in IE
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r232:f00dec11b375 - - 2 files changed: 6 inserted, 2 deleted

@@ -276,13 +276,13
276 276 @submission_timeouts = {}
277 277 problems.each do |problem|
278 278 assignment = @user.get_recent_test_pair_assignment_for(problem)
279 279 if assignment == nil
280 280 timeout = nil
281 281 else
282 - if assignment.expired?
282 + if (assignment.expired?) or (assignment.submitted)
283 283 timeout = 0
284 284 else
285 285 timeout = assignment.created_at + TEST_ASSIGNMENT_EXPIRATION_DURATION - Time.new.gmtime
286 286 end
287 287 end
288 288 @submission_timeouts[problem.id] = timeout
@@ -5,12 +5,14
5 5 inputDataDuration: 5, // 5 minutes
6 6
7 7 timeouts: [],
8 8
9 9 updateProblemMessages: function() {
10 10 CodejomTimeout.timeouts.each(function(data) {
11 + if(data==null)
12 + return;
11 13 if(data.timeout==null) {
12 14 $("problem-submission-form-" + data.problem).hide();
13 15 } else if(data.timeout==0) {
14 16 $("problem-timing-message-" + data.problem).innerHTML =
15 17 "The recent input data is expired. Please download a new one. You'll have 5 minute to submit.";
16 18 $("problem-submission-form-" + data.problem).hide();
@@ -23,12 +25,14
23 25 },
24 26
25 27 refreshProblemMessages: function() {
26 28 var timeElapsed = ((new Date()).getTime() - CodejomTimeout.timeStarted)/1000;
27 29 // update timeout info
28 30 CodejomTimeout.timeouts.each(function(data) {
31 + if(data==null)
32 + return;
29 33 if(data.timeout > timeElapsed) {
30 34 data.timeout -= timeElapsed;
31 35 } else if(data.timeout > 0) {
32 36 data.timeout = 0;
33 37 }
34 38 });
@@ -43,13 +47,13
43 47 CodejomTimeout.refreshProblemMessages();
44 48 }, 2700);
45 49 },
46 50
47 51 updateTimeoutAfterDownloadClick: function(problem) {
48 52 CodejomTimeout.timeouts
49 - .filter(function(data) { return data.problem==problem; })
53 + .filter(function(data) { return (data!=null) && (data.problem==problem); })
50 54 .each(function(data) {
51 55 if(data.timeout==0 || data.timeout==null) {
52 56 // TODO: use value from rails app.
53 57 data.timeout = CodejomTimeout.inputDataDuration * 60;
54 58 }
55 59 });
You need to be logged in to leave comments. Login now