Description:
import problem replaced old one, fixed small problems
problem validates name to have no space, test interface can deal with broken dependecies on problems.
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@436 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
r205:9bf8e38c2911 - - 5 files changed: 15 inserted, 3 deleted
@@ -156,6 +156,14 | |||||
|
156 | render :action => 'import' and return |
|
156 | render :action => 'import' and return |
|
157 | end |
|
157 | end |
|
158 |
|
158 | ||
|
|
159 | + old_problem = Problem.find_by_name(@problem.name) | ||
|
|
160 | + if old_problem!=nil | ||
|
|
161 | + old_problem.full_name = @problem.full_name | ||
|
|
162 | + @problem = old_problem | ||
|
|
163 | + | ||
|
|
164 | + flash[:notice] = "The test data has been replaced for problem #{@problem.name}" | ||
|
|
165 | + end | ||
|
|
166 | + | ||
|
159 | @problem.save |
|
167 | @problem.save |
|
160 | @log = import_log |
|
168 | @log = import_log |
|
161 | end |
|
169 | end |
@@ -101,7 +101,7 | |||||
|
101 | end |
|
101 | end |
|
102 | @test_requests = [] |
|
102 | @test_requests = [] |
|
103 | @user.test_requests.each do |ts| |
|
103 | @user.test_requests.each do |ts| |
|
104 | - if ts.problem.available |
|
104 | + if ts.problem and ts.problem.available |
|
105 | @test_requests << ts |
|
105 | @test_requests << ts |
|
106 | end |
|
106 | end |
|
107 | end |
|
107 | end |
@@ -3,8 +3,9 | |||||
|
3 | belongs_to :description |
|
3 | belongs_to :description |
|
4 |
|
4 | ||
|
5 | validates_presence_of :name |
|
5 | validates_presence_of :name |
|
|
6 | + validates_format_of :name, :with => /^\w+$/ | ||
|
6 | validates_presence_of :full_name |
|
7 | validates_presence_of :full_name |
|
7 | - |
|
8 | + |
|
8 | def self.find_available_problems |
|
9 | def self.find_available_problems |
|
9 | find(:all, :conditions => {:available => true}, :order => "date_added DESC") |
|
10 | find(:all, :conditions => {:available => true}, :order => "date_added DESC") |
|
10 | end |
|
11 | end |
@@ -4,6 +4,9 | |||||
|
4 |
|
4 | ||
|
5 | %h1 Grader information |
|
5 | %h1 Grader information |
|
6 |
|
6 | ||
|
|
7 | + = link_to '[Refresh]', :action => 'list' | ||
|
|
8 | + %br/ | ||
|
|
9 | + | ||
|
7 | .submitbox |
|
10 | .submitbox |
|
8 | .item |
|
11 | .item |
|
9 | Grader control: |
|
12 | Grader control: |
@@ -42,7 +42,7 | |||||
|
42 | elsif ext=='.tar' |
|
42 | elsif ext=='.tar' |
|
43 | cmd = "tar -xvf #{testdata_filename} -C #{extract_dir}" |
|
43 | cmd = "tar -xvf #{testdata_filename} -C #{extract_dir}" |
|
44 | elsif ext=='.zip' |
|
44 | elsif ext=='.zip' |
|
45 | - cmd = "unzip #{testdata_filename} -d #{extract_dir}" |
|
45 | + cmd = "unzip -o #{testdata_filename} -d #{extract_dir}" |
|
46 | else |
|
46 | else |
|
47 | return nil |
|
47 | return nil |
|
48 | end |
|
48 | end |
You need to be logged in to leave comments.
Login now