Description:
added contest model
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r266:48430f9891a7 - - 23 files changed: 367 inserted, 75 deleted
@@ -0,0 +1,38 | |||||
|
|
1 | + class ContestManagementController < ApplicationController | ||
|
|
2 | + | ||
|
|
3 | + before_filter :admin_authorization | ||
|
|
4 | + | ||
|
|
5 | + def index | ||
|
|
6 | + end | ||
|
|
7 | + | ||
|
|
8 | + def user_stat | ||
|
|
9 | + if not Configuration.indv_contest_mode? | ||
|
|
10 | + redirect_to :action => 'index' and return | ||
|
|
11 | + end | ||
|
|
12 | + | ||
|
|
13 | + @users = User.find(:all) | ||
|
|
14 | + @start_times = {} | ||
|
|
15 | + UserContestStat.find(:all).each do |stat| | ||
|
|
16 | + @start_times[stat.user_id] = stat.started_at | ||
|
|
17 | + end | ||
|
|
18 | + end | ||
|
|
19 | + | ||
|
|
20 | + def clear_stat | ||
|
|
21 | + user = User.find(params[:id]) | ||
|
|
22 | + if user.contest_stat!=nil | ||
|
|
23 | + user.contest_stat.destroy | ||
|
|
24 | + end | ||
|
|
25 | + redirect_to :action => 'user_stat' | ||
|
|
26 | + end | ||
|
|
27 | + | ||
|
|
28 | + def clear_all_stat | ||
|
|
29 | + if not Configuration.indv_contest_mode? | ||
|
|
30 | + redirect_to :action => 'index' and return | ||
|
|
31 | + end | ||
|
|
32 | + | ||
|
|
33 | + UserContestStat.delete_all() | ||
|
|
34 | + flash[:notice] = 'All start time statistic cleared.' | ||
|
|
35 | + redirect_to :action => 'index' | ||
|
|
36 | + end | ||
|
|
37 | + | ||
|
|
38 | + end |
@@ -0,0 +1,4 | |||||
|
|
1 | + .submitbox | ||
|
|
2 | + %b Menu: | ||
|
|
3 | + = link_to '[View user start time]', :action => 'user_stat' | ||
|
|
4 | + = link_to '[Clear all start times]', {:action => 'clear_all_stat'}, {:confirm => 'Do you really want to clear all start time statistics?'} |
@@ -0,0 +1,21 | |||||
|
|
1 | + %h1 Contest management | ||
|
|
2 | + | ||
|
|
3 | + .submitbox | ||
|
|
4 | + | ||
|
|
5 | + %b Multiple contests: | ||
|
|
6 | + = "There are #{Contest.count} contests running." | ||
|
|
7 | + = "[#{link_to 'Create/Update/Delete contests', :controller => 'contests', :action => 'index'}]" | ||
|
|
8 | + | ||
|
|
9 | + | ||
|
|
10 | + %b Contest mode: | ||
|
|
11 | + | ||
|
|
12 | + - if (not Configuration.contest_mode?) and (not Configuration.indv_contest_mode?) | ||
|
|
13 | + Currently the system is not running in contest mode. | ||
|
|
14 | + - elsif Configuration.contest_mode? | ||
|
|
15 | + System running in normal contest mode. | ||
|
|
16 | + - else | ||
|
|
17 | + System running in individual contest mode. | ||
|
|
18 | + = render :partial => 'indv_contest_mode_index' | ||
|
|
19 | + | ||
|
|
20 | + %br/ | ||
|
|
21 | + |
@@ -0,0 +1,24 | |||||
|
|
1 | + %h1 Individual Contest: User start time | ||
|
|
2 | + | ||
|
|
3 | + If you want to restart contest, you may want to | ||
|
|
4 | + %b | ||
|
|
5 | + = link_to '[clear all start times]', {:action => 'clear_all_stat'}, {:confirm => 'Do you really want to clear all start time statistics?'} | ||
|
|
6 | + so that users can participate again. | ||
|
|
7 | + | ||
|
|
8 | + %table.info | ||
|
|
9 | + %tr.info-head | ||
|
|
10 | + %th Login | ||
|
|
11 | + %th Start time | ||
|
|
12 | + %th Time left | ||
|
|
13 | + %th | ||
|
|
14 | + - @users.each_with_index do |user,i| | ||
|
|
15 | + %tr{:class => 'info-' + cycle('even','odd')} | ||
|
|
16 | + %td= user.login | ||
|
|
17 | + %td | ||
|
|
18 | + - if @start_times.has_key? user.id | ||
|
|
19 | + = @start_times[user.id] | ||
|
|
20 | + - else | ||
|
|
21 | + n/a | ||
|
|
22 | + %td= format_short_duration(user.contest_time_left) | ||
|
|
23 | + %td | ||
|
|
24 | + = link_to '[reset]', {:action => 'clear_stat', :id => user.id}, :confirm => 'Are you sure?' |
@@ -0,0 +1,20 | |||||
|
|
1 | + <h1>Editing contest</h1> | ||
|
|
2 | + | ||
|
|
3 | + <% form_for(@contest) do |f| %> | ||
|
|
4 | + <%= f.error_messages %> | ||
|
|
5 | + | ||
|
|
6 | + <p> | ||
|
|
7 | + <%= f.label :title %><br /> | ||
|
|
8 | + <%= f.text_field :title %> | ||
|
|
9 | + </p> | ||
|
|
10 | + <p> | ||
|
|
11 | + <%= f.label :enabled %><br /> | ||
|
|
12 | + <%= f.check_box :enabled %> | ||
|
|
13 | + </p> | ||
|
|
14 | + <p> | ||
|
|
15 | + <%= f.submit 'Update' %> | ||
|
|
16 | + </p> | ||
|
|
17 | + <% end %> | ||
|
|
18 | + | ||
|
|
19 | + <%= link_to 'Show', @contest %> | | ||
|
|
20 | + <%= link_to 'Back', contests_path %> No newline at end of file |
@@ -0,0 +1,26 | |||||
|
|
1 | + <h1>Listing contests</h1> | ||
|
|
2 | + | ||
|
|
3 | + <div class="submitbox"> | ||
|
|
4 | + <b>Go back</b> to [<%= link_to 'contest management', :controller => 'contest_management', :action => 'index' %>] | ||
|
|
5 | + </div> | ||
|
|
6 | + | ||
|
|
7 | + <table> | ||
|
|
8 | + <tr> | ||
|
|
9 | + <th>Title</th> | ||
|
|
10 | + <th>Enabled</th> | ||
|
|
11 | + </tr> | ||
|
|
12 | + | ||
|
|
13 | + <% @contests.each do |contest| %> | ||
|
|
14 | + <tr> | ||
|
|
15 | + <td><%=h contest.title %></td> | ||
|
|
16 | + <td><%=h contest.enabled %></td> | ||
|
|
17 | + <td><%= link_to 'Show', contest %></td> | ||
|
|
18 | + <td><%= link_to 'Edit', edit_contest_path(contest) %></td> | ||
|
|
19 | + <td><%= link_to 'Destroy', contest, :confirm => 'Are you sure?', :method => :delete %></td> | ||
|
|
20 | + </tr> | ||
|
|
21 | + <% end %> | ||
|
|
22 | + </table> | ||
|
|
23 | + | ||
|
|
24 | + <br /> | ||
|
|
25 | + | ||
|
|
26 | + <%= link_to 'New contest', new_contest_path %> |
@@ -0,0 +1,19 | |||||
|
|
1 | + <h1>New contest</h1> | ||
|
|
2 | + | ||
|
|
3 | + <% form_for(@contest) do |f| %> | ||
|
|
4 | + <%= f.error_messages %> | ||
|
|
5 | + | ||
|
|
6 | + <p> | ||
|
|
7 | + <%= f.label :title %><br /> | ||
|
|
8 | + <%= f.text_field :title %> | ||
|
|
9 | + </p> | ||
|
|
10 | + <p> | ||
|
|
11 | + <%= f.label :enabled %><br /> | ||
|
|
12 | + <%= f.check_box :enabled %> | ||
|
|
13 | + </p> | ||
|
|
14 | + <p> | ||
|
|
15 | + <%= f.submit 'Create' %> | ||
|
|
16 | + </p> | ||
|
|
17 | + <% end %> | ||
|
|
18 | + | ||
|
|
19 | + <%= link_to 'Back', contests_path %> No newline at end of file |
@@ -0,0 +1,13 | |||||
|
|
1 | + <p> | ||
|
|
2 | + <b>Title:</b> | ||
|
|
3 | + <%=h @contest.title %> | ||
|
|
4 | + </p> | ||
|
|
5 | + | ||
|
|
6 | + <p> | ||
|
|
7 | + <b>Enabled:</b> | ||
|
|
8 | + <%=h @contest.enabled %> | ||
|
|
9 | + </p> | ||
|
|
10 | + | ||
|
|
11 | + | ||
|
|
12 | + <%= link_to 'Edit', edit_contest_path(@contest) %> | | ||
|
|
13 | + <%= link_to 'Back', contests_path %> No newline at end of file |
@@ -0,0 +1,14 | |||||
|
|
1 | + class CreateContests < ActiveRecord::Migration | ||
|
|
2 | + def self.up | ||
|
|
3 | + create_table :contests do |t| | ||
|
|
4 | + t.string :title | ||
|
|
5 | + t.boolean :enabled | ||
|
|
6 | + | ||
|
|
7 | + t.timestamps | ||
|
|
8 | + end | ||
|
|
9 | + end | ||
|
|
10 | + | ||
|
|
11 | + def self.down | ||
|
|
12 | + drop_table :contests | ||
|
|
13 | + end | ||
|
|
14 | + end |
@@ -0,0 +1,9 | |||||
|
|
1 | + # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html | ||
|
|
2 | + | ||
|
|
3 | + one: | ||
|
|
4 | + title: MyString | ||
|
|
5 | + enabled: false | ||
|
|
6 | + | ||
|
|
7 | + two: | ||
|
|
8 | + title: MyString | ||
|
|
9 | + enabled: false |
@@ -0,0 +1,8 | |||||
|
|
1 | + require 'test_helper' | ||
|
|
2 | + | ||
|
|
3 | + class ContestManagementControllerTest < ActionController::TestCase | ||
|
|
4 | + # Replace this with your real tests. | ||
|
|
5 | + test "the truth" do | ||
|
|
6 | + assert true | ||
|
|
7 | + end | ||
|
|
8 | + end |
@@ -0,0 +1,8 | |||||
|
|
1 | + require 'test_helper' | ||
|
|
2 | + | ||
|
|
3 | + class ContestTest < ActiveSupport::TestCase | ||
|
|
4 | + # Replace this with your real tests. | ||
|
|
5 | + test "the truth" do | ||
|
|
6 | + assert true | ||
|
|
7 | + end | ||
|
|
8 | + end |
@@ -0,0 +1,4 | |||||
|
|
1 | + require 'test_helper' | ||
|
|
2 | + | ||
|
|
3 | + class ContestManagementHelperTest < ActionView::TestCase | ||
|
|
4 | + end |
@@ -1,38 +1,89 | |||||
|
1 | class ContestsController < ApplicationController |
|
1 | class ContestsController < ApplicationController |
|
2 |
|
2 | ||
|
3 | before_filter :admin_authorization |
|
3 | before_filter :admin_authorization |
|
4 |
|
4 | ||
|
|
5 | + # GET /contests | ||
|
|
6 | + # GET /contests.xml | ||
|
5 | def index |
|
7 | def index |
|
|
8 | + @contests = Contest.all | ||
|
|
9 | + | ||
|
|
10 | + respond_to do |format| | ||
|
|
11 | + format.html # index.html.erb | ||
|
|
12 | + format.xml { render :xml => @contests } | ||
|
|
13 | + end | ||
|
6 | end |
|
14 | end |
|
7 |
|
15 | ||
|
8 | - def user_stat |
|
16 | + # GET /contests/1 |
|
9 | - if not Configuration.indv_contest_mode? |
|
17 | + # GET /contests/1.xml |
|
10 | - redirect_to :action => 'index' and return |
|
18 | + def show |
|
11 | - end |
|
19 | + @contest = Contest.find(params[:id]) |
|
12 |
|
20 | ||
|
13 | - @users = User.find(:all) |
|
21 | + respond_to do |format| |
|
14 | - @start_times = {} |
|
22 | + format.html # show.html.erb |
|
15 | - UserContestStat.find(:all).each do |stat| |
|
23 | + format.xml { render :xml => @contest } |
|
16 | - @start_times[stat.user_id] = stat.started_at |
|
24 | + end |
|
|
25 | + end | ||
|
|
26 | + | ||
|
|
27 | + # GET /contests/new | ||
|
|
28 | + # GET /contests/new.xml | ||
|
|
29 | + def new | ||
|
|
30 | + @contest = Contest.new | ||
|
|
31 | + | ||
|
|
32 | + respond_to do |format| | ||
|
|
33 | + format.html # new.html.erb | ||
|
|
34 | + format.xml { render :xml => @contest } | ||
|
17 | end |
|
35 | end |
|
18 | end |
|
36 | end |
|
19 |
|
37 | ||
|
20 | - def clear_stat |
|
38 | + # GET /contests/1/edit |
|
21 | - user = User.find(params[:id]) |
|
39 | + def edit |
|
22 | - if user.contest_stat!=nil |
|
40 | + @contest = Contest.find(params[:id]) |
|
23 | - user.contest_stat.destroy |
|
41 | + end |
|
|
42 | + | ||
|
|
43 | + # POST /contests | ||
|
|
44 | + # POST /contests.xml | ||
|
|
45 | + def create | ||
|
|
46 | + @contest = Contest.new(params[:contest]) | ||
|
|
47 | + | ||
|
|
48 | + respond_to do |format| | ||
|
|
49 | + if @contest.save | ||
|
|
50 | + flash[:notice] = 'Contest was successfully created.' | ||
|
|
51 | + format.html { redirect_to(@contest) } | ||
|
|
52 | + format.xml { render :xml => @contest, :status => :created, :location => @contest } | ||
|
|
53 | + else | ||
|
|
54 | + format.html { render :action => "new" } | ||
|
|
55 | + format.xml { render :xml => @contest.errors, :status => :unprocessable_entity } | ||
|
|
56 | + end | ||
|
24 | end |
|
57 | end |
|
25 | - redirect_to :action => 'user_stat' |
|
||
|
26 | end |
|
58 | end |
|
27 |
|
59 | ||
|
28 | - def clear_all_stat |
|
60 | + # PUT /contests/1 |
|
29 | - if not Configuration.indv_contest_mode? |
|
61 | + # PUT /contests/1.xml |
|
30 | - redirect_to :action => 'index' and return |
|
62 | + def update |
|
|
63 | + @contest = Contest.find(params[:id]) | ||
|
|
64 | + | ||
|
|
65 | + respond_to do |format| | ||
|
|
66 | + if @contest.update_attributes(params[:contest]) | ||
|
|
67 | + flash[:notice] = 'Contest was successfully updated.' | ||
|
|
68 | + format.html { redirect_to(@contest) } | ||
|
|
69 | + format.xml { head :ok } | ||
|
|
70 | + else | ||
|
|
71 | + format.html { render :action => "edit" } | ||
|
|
72 | + format.xml { render :xml => @contest.errors, :status => :unprocessable_entity } | ||
|
|
73 | + end | ||
|
31 | end |
|
74 | end |
|
|
75 | + end | ||
|
32 |
|
76 | ||
|
33 | - UserContestStat.delete_all() |
|
77 | + # DELETE /contests/1 |
|
34 | - flash[:notice] = 'All start time statistic cleared.' |
|
78 | + # DELETE /contests/1.xml |
|
35 | - redirect_to :action => 'index' |
|
79 | + def destroy |
|
|
80 | + @contest = Contest.find(params[:id]) | ||
|
|
81 | + @contest.destroy | ||
|
|
82 | + | ||
|
|
83 | + respond_to do |format| | ||
|
|
84 | + format.html { redirect_to(contests_url) } | ||
|
|
85 | + format.xml { head :ok } | ||
|
|
86 | + end | ||
|
36 | end |
|
87 | end |
|
37 |
|
88 | ||
|
38 | end |
|
89 | end |
@@ -11,13 +11,13 | |||||
|
11 | append_to menu_items, '[Announcements]', 'announcements', 'index' |
|
11 | append_to menu_items, '[Announcements]', 'announcements', 'index' |
|
12 | append_to menu_items, '[Msg console]', 'messages', 'console' |
|
12 | append_to menu_items, '[Msg console]', 'messages', 'console' |
|
13 | append_to menu_items, '[Problems]', 'problems', 'index' |
|
13 | append_to menu_items, '[Problems]', 'problems', 'index' |
|
14 | append_to menu_items, '[Users]', 'user_admin', 'index' |
|
14 | append_to menu_items, '[Users]', 'user_admin', 'index' |
|
15 | append_to menu_items, '[Results]', 'user_admin', 'user_stat' |
|
15 | append_to menu_items, '[Results]', 'user_admin', 'user_stat' |
|
16 | append_to menu_items, '[Graders]', 'graders', 'list' |
|
16 | append_to menu_items, '[Graders]', 'graders', 'list' |
|
17 |
- append_to menu_items, '[Contests]', 'contest |
|
17 | + append_to menu_items, '[Contests]', 'contest_management', 'index' |
|
18 | append_to menu_items, '[Sites]', 'sites', 'index' |
|
18 | append_to menu_items, '[Sites]', 'sites', 'index' |
|
19 | append_to menu_items, '[System config]', 'configurations', 'index' |
|
19 | append_to menu_items, '[System config]', 'configurations', 'index' |
|
20 | menu_items << "<br/>" |
|
20 | menu_items << "<br/>" |
|
21 | end |
|
21 | end |
|
22 |
|
22 | ||
|
23 | # main page |
|
23 | # main page |
@@ -1,7 +1,9 | |||||
|
1 | ActionController::Routing::Routes.draw do |map| |
|
1 | ActionController::Routing::Routes.draw do |map| |
|
|
2 | + map.resources :contests | ||
|
|
3 | + | ||
|
2 | map.resources :announcements |
|
4 | map.resources :announcements |
|
3 | map.resources :sites |
|
5 | map.resources :sites |
|
4 |
|
6 | ||
|
5 | # The priority is based upon order of creation: first created -> highest priority. |
|
7 | # The priority is based upon order of creation: first created -> highest priority. |
|
6 |
|
8 | ||
|
7 | # Sample of regular route: |
|
9 | # Sample of regular route: |
@@ -6,34 +6,49 | |||||
|
6 | # to create the application database on another system, you should be using db:schema:load, not running |
|
6 | # to create the application database on another system, you should be using db:schema:load, not running |
|
7 | # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations |
|
7 | # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations |
|
8 | # you'll amass, the slower it'll run and the greater likelihood for issues). |
|
8 | # you'll amass, the slower it'll run and the greater likelihood for issues). |
|
9 | # |
|
9 | # |
|
10 | # It's strongly recommended to check this file into your version control system. |
|
10 | # It's strongly recommended to check this file into your version control system. |
|
11 |
|
11 | ||
|
12 |
- ActiveRecord::Schema.define(:version => 20100 |
|
12 | + ActiveRecord::Schema.define(:version => 20100216105730) do |
|
13 |
|
13 | ||
|
14 | create_table "announcements", :force => true do |t| |
|
14 | create_table "announcements", :force => true do |t| |
|
15 | t.string "author" |
|
15 | t.string "author" |
|
16 | t.text "body" |
|
16 | t.text "body" |
|
17 | t.boolean "published" |
|
17 | t.boolean "published" |
|
18 | t.datetime "created_at" |
|
18 | t.datetime "created_at" |
|
19 | t.datetime "updated_at" |
|
19 | t.datetime "updated_at" |
|
20 | t.boolean "frontpage", :default => false |
|
20 | t.boolean "frontpage", :default => false |
|
21 | t.boolean "contest_only", :default => false |
|
21 | t.boolean "contest_only", :default => false |
|
22 | t.string "title" |
|
22 | t.string "title" |
|
23 | end |
|
23 | end |
|
24 |
|
24 | ||
|
|
25 | + create_table "codejom_statuses", :force => true do |t| | ||
|
|
26 | + t.integer "user_id" | ||
|
|
27 | + t.boolean "alive" | ||
|
|
28 | + t.integer "num_problems_passed" | ||
|
|
29 | + t.datetime "created_at" | ||
|
|
30 | + t.datetime "updated_at" | ||
|
|
31 | + end | ||
|
|
32 | + | ||
|
25 | create_table "configurations", :force => true do |t| |
|
33 | create_table "configurations", :force => true do |t| |
|
26 | t.string "key" |
|
34 | t.string "key" |
|
27 | t.string "value_type" |
|
35 | t.string "value_type" |
|
28 | t.string "value" |
|
36 | t.string "value" |
|
29 | t.datetime "created_at" |
|
37 | t.datetime "created_at" |
|
30 | t.datetime "updated_at" |
|
38 | t.datetime "updated_at" |
|
31 | t.text "description" |
|
39 | t.text "description" |
|
32 | end |
|
40 | end |
|
33 |
|
41 | ||
|
|
42 | + create_table "contests", :force => true do |t| | ||
|
|
43 | + t.string "title" | ||
|
|
44 | + t.boolean "enabled" | ||
|
|
45 | + t.datetime "created_at" | ||
|
|
46 | + t.datetime "updated_at" | ||
|
|
47 | + end | ||
|
|
48 | + | ||
|
34 | create_table "countries", :force => true do |t| |
|
49 | create_table "countries", :force => true do |t| |
|
35 | t.string "name" |
|
50 | t.string "name" |
|
36 | t.datetime "created_at" |
|
51 | t.datetime "created_at" |
|
37 | t.datetime "updated_at" |
|
52 | t.datetime "updated_at" |
|
38 | end |
|
53 | end |
|
39 |
|
54 | ||
@@ -73,21 +88,23 | |||||
|
73 | t.boolean "replied" |
|
88 | t.boolean "replied" |
|
74 | t.datetime "created_at" |
|
89 | t.datetime "created_at" |
|
75 | t.datetime "updated_at" |
|
90 | t.datetime "updated_at" |
|
76 | end |
|
91 | end |
|
77 |
|
92 | ||
|
78 | create_table "problems", :force => true do |t| |
|
93 | create_table "problems", :force => true do |t| |
|
79 | - t.string "name", :limit => 30 |
|
94 | + t.string "name", :limit => 30 |
|
80 | - t.string "full_name" |
|
95 | + t.string "full_name" |
|
81 | - t.integer "full_score" |
|
96 | + t.integer "full_score" |
|
82 | - t.date "date_added" |
|
97 | + t.date "date_added" |
|
83 | - t.boolean "available" |
|
98 | + t.boolean "available" |
|
84 | - t.string "url" |
|
99 | + t.string "url" |
|
85 | - t.integer "description_id" |
|
100 | + t.integer "description_id" |
|
86 | - t.boolean "test_allowed" |
|
101 | + t.boolean "test_allowed" |
|
87 | - t.boolean "output_only" |
|
102 | + t.boolean "output_only" |
|
|
103 | + t.integer "level", :default => 0 | ||
|
|
104 | + t.datetime "updated_at" | ||
|
88 | end |
|
105 | end |
|
89 |
|
106 | ||
|
90 | create_table "rights", :force => true do |t| |
|
107 | create_table "rights", :force => true do |t| |
|
91 | t.string "name" |
|
108 | t.string "name" |
|
92 | t.string "controller" |
|
109 | t.string "controller" |
|
93 | t.string "action" |
|
110 | t.string "action" |
@@ -175,14 +192,14 | |||||
|
175 | t.datetime "updated_at" |
|
192 | t.datetime "updated_at" |
|
176 | t.boolean "submitted" |
|
193 | t.boolean "submitted" |
|
177 | end |
|
194 | end |
|
178 |
|
195 | ||
|
179 | create_table "test_pairs", :force => true do |t| |
|
196 | create_table "test_pairs", :force => true do |t| |
|
180 | t.integer "problem_id" |
|
197 | t.integer "problem_id" |
|
181 | - t.text "input" |
|
198 | + t.text "input", :limit => 16777215 |
|
182 | - t.text "solution" |
|
199 | + t.text "solution", :limit => 16777215 |
|
183 | t.datetime "created_at" |
|
200 | t.datetime "created_at" |
|
184 | t.datetime "updated_at" |
|
201 | t.datetime "updated_at" |
|
185 | t.integer "number" |
|
202 | t.integer "number" |
|
186 | end |
|
203 | end |
|
187 |
|
204 | ||
|
188 | create_table "test_requests", :force => true do |t| |
|
205 | create_table "test_requests", :force => true do |t| |
@@ -212,22 +229,32 | |||||
|
212 | t.datetime "started_at" |
|
229 | t.datetime "started_at" |
|
213 | t.datetime "created_at" |
|
230 | t.datetime "created_at" |
|
214 | t.datetime "updated_at" |
|
231 | t.datetime "updated_at" |
|
215 | end |
|
232 | end |
|
216 |
|
233 | ||
|
217 | create_table "users", :force => true do |t| |
|
234 | create_table "users", :force => true do |t| |
|
218 | - t.string "login", :limit => 50 |
|
235 | + t.string "login", :limit => 50 |
|
219 | t.string "full_name" |
|
236 | t.string "full_name" |
|
220 | t.string "hashed_password" |
|
237 | t.string "hashed_password" |
|
221 | - t.string "salt", :limit => 5 |
|
238 | + t.string "salt", :limit => 5 |
|
222 | t.string "alias" |
|
239 | t.string "alias" |
|
223 | t.string "email" |
|
240 | t.string "email" |
|
224 | t.integer "site_id" |
|
241 | t.integer "site_id" |
|
225 | t.integer "country_id" |
|
242 | t.integer "country_id" |
|
226 | - t.boolean "activated", :default => false |
|
243 | + t.boolean "activated", :default => false |
|
227 | t.datetime "created_at" |
|
244 | t.datetime "created_at" |
|
228 | t.datetime "updated_at" |
|
245 | t.datetime "updated_at" |
|
|
246 | + t.string "member1_full_name" | ||
|
|
247 | + t.string "member2_full_name" | ||
|
|
248 | + t.string "member3_full_name" | ||
|
|
249 | + t.boolean "high_school" | ||
|
|
250 | + t.string "member1_school_name" | ||
|
|
251 | + t.string "member2_school_name" | ||
|
|
252 | + t.string "member3_school_name" | ||
|
|
253 | + t.string "school_name" | ||
|
|
254 | + t.string "province" | ||
|
|
255 | + t.integer "year" | ||
|
229 | end |
|
256 | end |
|
230 |
|
257 | ||
|
231 | add_index "users", ["login"], :name => "index_users_on_login", :unique => true |
|
258 | add_index "users", ["login"], :name => "index_users_on_login", :unique => true |
|
232 |
|
259 | ||
|
233 | end |
|
260 | end |
@@ -1,8 +1,45 | |||||
|
1 | require 'test_helper' |
|
1 | require 'test_helper' |
|
2 |
|
2 | ||
|
3 | class ContestsControllerTest < ActionController::TestCase |
|
3 | class ContestsControllerTest < ActionController::TestCase |
|
4 | - # Replace this with your real tests. |
|
4 | + test "should get index" do |
|
5 | - test "the truth" do |
|
5 | + get :index |
|
6 |
- assert |
|
6 | + assert_response :success |
|
|
7 | + assert_not_nil assigns(:contests) | ||
|
|
8 | + end | ||
|
|
9 | + | ||
|
|
10 | + test "should get new" do | ||
|
|
11 | + get :new | ||
|
|
12 | + assert_response :success | ||
|
|
13 | + end | ||
|
|
14 | + | ||
|
|
15 | + test "should create contest" do | ||
|
|
16 | + assert_difference('Contest.count') do | ||
|
|
17 | + post :create, :contest => { } | ||
|
|
18 | + end | ||
|
|
19 | + | ||
|
|
20 | + assert_redirected_to contest_path(assigns(:contest)) | ||
|
|
21 | + end | ||
|
|
22 | + | ||
|
|
23 | + test "should show contest" do | ||
|
|
24 | + get :show, :id => contests(:one).to_param | ||
|
|
25 | + assert_response :success | ||
|
|
26 | + end | ||
|
|
27 | + | ||
|
|
28 | + test "should get edit" do | ||
|
|
29 | + get :edit, :id => contests(:one).to_param | ||
|
|
30 | + assert_response :success | ||
|
|
31 | + end | ||
|
|
32 | + | ||
|
|
33 | + test "should update contest" do | ||
|
|
34 | + put :update, :id => contests(:one).to_param, :contest => { } | ||
|
|
35 | + assert_redirected_to contest_path(assigns(:contest)) | ||
|
|
36 | + end | ||
|
|
37 | + | ||
|
|
38 | + test "should destroy contest" do | ||
|
|
39 | + assert_difference('Contest.count', -1) do | ||
|
|
40 | + delete :destroy, :id => contests(:one).to_param | ||
|
|
41 | + end | ||
|
|
42 | + | ||
|
|
43 | + assert_redirected_to contests_path | ||
|
7 | end |
|
44 | end |
|
8 | end |
|
45 | end |
deleted file |
deleted file |
deleted file |
You need to be logged in to leave comments.
Login now