diff --git a/tutor/app/controllers/contests_controller.rb b/tutor/app/controllers/contests_controller.rb index b558ba48..a5d3866d 100644 --- a/tutor/app/controllers/contests_controller.rb +++ b/tutor/app/controllers/contests_controller.rb @@ -16,7 +16,13 @@ def index elsif teaching_assistant_signed_in? @contests = current_teaching_assistant.contests elsif student_signed_in? - @contests = current_student.contests + @my_contests = current_student.contests + @courses = current_student.courses + @courses.each do |course| + course.contests.each do |contest| + @contests << contest + end + end end end diff --git a/tutor/app/views/contests/index.html.erb b/tutor/app/views/contests/index.html.erb index 3a94e1cc..46875392 100644 --- a/tutor/app/views/contests/index.html.erb +++ b/tutor/app/views/contests/index.html.erb @@ -3,7 +3,37 @@ style="width:180px;display:inline"><%= flash[:notice] %> <% end %> -
Contests | +Start date | +Start time | +Duration | +
+ <%= link_to contest.title, :controller => 'contests', :action=> 'show', + :id => contest.id,:method => :get, class: + "btn btn-success" %>+ |
+
+ <%= contest.start_date %>+ |
+
+ <%= contest.start_time %>+ |
+
+ <%= contest.end_time.to_i - contest.start_time.to_i / (60*60) %>+ |
+