diff --git a/app/models/user.rb b/app/models/user.rb --- a/app/models/user.rb +++ b/app/models/user.rb @@ -111,6 +111,7 @@ begin http = Net::HTTP.new('www.cas.chula.ac.th', 443) http.use_ssl = true + http.verify_mode = OpenSSL::SSL::VERIFY_NONE result = [ ] http.start do |http| req = Net::HTTP::Post.new('/cas/api/?q=studentAuthenticate') @@ -119,7 +120,7 @@ result = JSON.parse resp.body end return true if result["type"] == "beanStudent" - rescue + rescue => e return false end return false @@ -239,7 +240,7 @@ def update_start_time stat = self.contest_stat - if (stat.nil?) or (stat.started_at.nil?) + if stat.nil? or stat.started_at.nil? stat ||= UserContestStat.new(:user => self) stat.started_at = Time.now.gmtime stat.save diff --git a/app/views/graders/_grader.html.haml b/app/views/graders/_grader.html.haml --- a/app/views/graders/_grader.html.haml +++ b/app/views/graders/_grader.html.haml @@ -2,10 +2,10 @@ %td= grader.host %td= grader.pid %td= grader.mode -%td= grader.updated_at.strftime("%H:%M:%S") unless grader.updated_at.nil? +%td= grader.updated_at.strftime("%H:%M:%S") if grader.updated_at %td= grader.task_type %td - - if grader.task_id.nil? + - unless grader.task_id idle - else = link_to "#{grader.task_id}", :action => 'view', :id => grader.task_id, :type => grader.task_type diff --git a/app/views/main/_submission_short.html.haml b/app/views/main/_submission_short.html.haml --- a/app/views/main/_submission_short.html.haml +++ b/app/views/main/_submission_short.html.haml @@ -22,5 +22,5 @@ = link_to("[#{t 'main.cmp_msg'}]", {:action => 'compiler_msg', :id => submission.id}, {:popup => true}) = " | " = link_to("[#{t 'main.src_link'}]",{:action => 'source', :id => submission.id}) - //= " | " - //= link_to "[#{t 'main.submissions_link'}]", main_submission_path(submission.problem.id) + = " | " + = link_to "[#{t 'main.submissions_link'}]", :action => 'submission', :id => problem_name diff --git a/app/views/user_admin/user_stat.html.haml b/app/views/user_admin/user_stat.html.haml --- a/app/views/user_admin/user_stat.html.haml +++ b/app/views/user_admin/user_stat.html.haml @@ -48,7 +48,7 @@ %td= link_to sc[i].login, controller: 'users', action: 'profile', id: sc[i] %td= sc[i].full_name %td= sc[i].activated - %td= sc[i].try(:contest_stat).try(:started_at)!=nil ? 'yes' : 'no' + %td= sc[i].try(:contest_stat).try(:started_at) ? 'yes' : 'no' %td= sc[i].contests.collect {|c| c.name}.join(', ') %td= sc[i].remark - else