Description:
fixed submission bug: forgot to set problem attribute in case that the problem is set in the submission code.
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@100 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r48:0bbd9fb65914 - - 1 file changed: 2 inserted, 0 deleted
@@ -98,23 +98,25 | |||
|
98 | 98 | |
|
99 | 99 | def must_have_valid_problem |
|
100 | 100 | return if self.source==nil |
|
101 | 101 | if self.problem_id!=-1 |
|
102 | 102 | problem = Problem.find(self.problem_id) |
|
103 | 103 | else |
|
104 | 104 | problem = Submission.find_problem_in_source(self.source) |
|
105 | 105 | end |
|
106 | 106 | if problem==nil |
|
107 | 107 | errors.add_to_base("must specify problem") |
|
108 | 108 | elsif !problem.available |
|
109 | 109 | errors.add_to_base("must specify valid problem") |
|
110 | + else | |
|
111 | + self.problem = problem | |
|
110 | 112 | end |
|
111 | 113 | end |
|
112 | 114 | |
|
113 | 115 | # callbacks |
|
114 | 116 | def assign_latest_number_if_new_recond |
|
115 | 117 | return if !self.new_record? |
|
116 | 118 | latest = Submission.find_last_by_user_and_problem(self.user_id, self.problem_id) |
|
117 | 119 | self.number = (latest==nil) ? 1 : latest.number + 1; |
|
118 | 120 | end |
|
119 | 121 | |
|
120 | 122 | end |
You need to be logged in to leave comments.
Login now