Description:
add submissions to users
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r738:d514585a072a - - 1 file changed: 2 inserted, 0 deleted
@@ -4,24 +4,26 | |||||
|
4 | has_and_belongs_to_many :contests, :uniq => true |
|
4 | has_and_belongs_to_many :contests, :uniq => true |
|
5 |
|
5 | ||
|
6 | #has_and_belongs_to_many :groups |
|
6 | #has_and_belongs_to_many :groups |
|
7 | has_many :groups_problems, class_name: GroupProblem |
|
7 | has_many :groups_problems, class_name: GroupProblem |
|
8 | has_many :groups, :through => :groups_problems |
|
8 | has_many :groups, :through => :groups_problems |
|
9 |
|
9 | ||
|
10 | has_many :problems_tags, class_name: ProblemTag |
|
10 | has_many :problems_tags, class_name: ProblemTag |
|
11 | has_many :tags, through: :problems_tags |
|
11 | has_many :tags, through: :problems_tags |
|
12 |
|
12 | ||
|
13 | has_many :test_pairs, :dependent => :delete_all |
|
13 | has_many :test_pairs, :dependent => :delete_all |
|
14 | has_many :testcases, :dependent => :destroy |
|
14 | has_many :testcases, :dependent => :destroy |
|
15 |
|
15 | ||
|
|
16 | + has_many :submissions | ||
|
|
17 | + | ||
|
16 | validates_presence_of :name |
|
18 | validates_presence_of :name |
|
17 | validates_format_of :name, :with => /\A\w+\z/ |
|
19 | validates_format_of :name, :with => /\A\w+\z/ |
|
18 | validates_presence_of :full_name |
|
20 | validates_presence_of :full_name |
|
19 |
|
21 | ||
|
20 | scope :available, -> { where(available: true) } |
|
22 | scope :available, -> { where(available: true) } |
|
21 |
|
23 | ||
|
22 | DEFAULT_TIME_LIMIT = 1 |
|
24 | DEFAULT_TIME_LIMIT = 1 |
|
23 | DEFAULT_MEMORY_LIMIT = 32 |
|
25 | DEFAULT_MEMORY_LIMIT = 32 |
|
24 |
|
26 | ||
|
25 | def self.available_problems |
|
27 | def self.available_problems |
|
26 | available.order(date_added: :desc).order(:name) |
|
28 | available.order(date_added: :desc).order(:name) |
|
27 | #Problem.available.all(:order => "date_added DESC, name ASC") |
|
29 | #Problem.available.all(:order => "date_added DESC, name ASC") |
You need to be logged in to leave comments.
Login now