Description:
add 2nd level sort problem by name (not full name)
show problem name before full_name in main/list
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r409:4e03b3c502cc - - 2 files changed: 2 inserted, 2 deleted
@@ -1,41 +1,41 | |||
|
1 | 1 | class Problem < ActiveRecord::Base |
|
2 | 2 | |
|
3 | 3 | belongs_to :description |
|
4 | 4 | has_and_belongs_to_many :contests, :uniq => true |
|
5 | 5 | has_many :test_pairs, :dependent => :delete_all |
|
6 | 6 | |
|
7 | 7 | validates_presence_of :name |
|
8 | 8 | validates_format_of :name, :with => /^\w+$/ |
|
9 | 9 | validates_presence_of :full_name |
|
10 | 10 | |
|
11 | 11 | scope :available, :conditions => {:available => true} |
|
12 | 12 | |
|
13 | 13 | DEFAULT_TIME_LIMIT = 1 |
|
14 | 14 | DEFAULT_MEMORY_LIMIT = 32 |
|
15 | 15 | |
|
16 | 16 | def self.find_available_problems |
|
17 | - Problem.available.all(:order => "date_added DESC") | |
|
17 | + Problem.available.all(:order => "date_added DESC, name ASC") | |
|
18 | 18 | end |
|
19 | 19 | |
|
20 | 20 | def self.create_from_import_form_params(params, old_problem=nil) |
|
21 | 21 | org_problem = old_problem || Problem.new |
|
22 | 22 | import_params, problem = Problem.extract_params_and_check(params, |
|
23 | 23 | org_problem) |
|
24 | 24 | |
|
25 | 25 | if !problem.errors.empty? |
|
26 | 26 | return problem, 'Error importing' |
|
27 | 27 | end |
|
28 | 28 | |
|
29 | 29 | problem.full_score = 100 |
|
30 | 30 | problem.date_added = Time.new |
|
31 | 31 | problem.test_allowed = true |
|
32 | 32 | problem.output_only = false |
|
33 | 33 | problem.available = false |
|
34 | 34 | |
|
35 | 35 | if not problem.save |
|
36 | 36 | return problem, 'Error importing' |
|
37 | 37 | end |
|
38 | 38 | |
|
39 | 39 | import_to_db = params.has_key? :import_to_db |
|
40 | 40 | |
|
41 | 41 | importer = TestdataImporter.new(problem) |
@@ -1,18 +1,18 | |||
|
1 | 1 | <tr class="info-<%= (problem_counter%2==0) ? "even" : "odd" %>"> |
|
2 | 2 | <td> |
|
3 | 3 | <%= "#{problem_counter+1}" %> |
|
4 | 4 | </td> |
|
5 | 5 | <td> |
|
6 |
- <%= "#{problem.full_name} |
|
|
6 | + <%= "(#{problem.name}) #{problem.full_name}" %> | |
|
7 | 7 | <%= link_to_description_if_any "[#{t 'main.problem_desc'}]", problem %> |
|
8 | 8 | </td> |
|
9 | 9 | <td align="center"> |
|
10 | 10 | <%= @prob_submissions[problem.id][:count] %> |
|
11 | 11 | </td> |
|
12 | 12 | <td> |
|
13 | 13 | <%= render :partial => 'submission_short', |
|
14 | 14 | :locals => { |
|
15 | 15 | :submission => @prob_submissions[problem.id][:submission], |
|
16 | 16 | :problem_name => problem.name }%> |
|
17 | 17 | </td> |
|
18 | 18 | </tr> |
You need to be logged in to leave comments.
Login now