From fec1015604de5a432179f67bdf188eef3b25b510 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 8 Jul 2016 15:44:14 +0800 Subject: [PATCH 01/20] =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E6=B5=8B=E9=AA=8C?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E5=88=97=E8=A1=A8=E8=B6=85=E5=87=BAbug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/schema.rb | 17 ----------------- public/stylesheets/courses.css | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 7b78016d9..74348a958 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1137,23 +1137,6 @@ ActiveRecord::Schema.define(:version => 20160708005533) do t.integer "viewed_count", :default => 0 end - create_table "mess", :id => false, :force => true do |t| - t.string "课程名" - t.integer "课程ID", :default => 0, :null => false - t.string "教师姓", :default => "", :null => false - t.string "教师名", :limit => 30, :default => "", :null => false - t.string "主贴名", :default => "", :null => false - t.integer "主贴或回帖ID", :default => 0, :null => false - t.integer "回帖对应主贴ID" - t.integer "帖子点赞数" - t.integer "主贴回复数", :default => 0, :null => false - t.text "主贴或回帖内容" - t.datetime "发帖时间", :null => false - t.integer "发帖或回帖用户ID", :default => 0, :null => false - t.string "发帖或回帖用户姓", :default => "", :null => false - t.string "发帖或回帖用户名", :limit => 30, :default => "", :null => false - end - create_table "message_alls", :force => true do |t| t.integer "user_id" t.integer "message_id" diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 24a8671ae..174f572fa 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -57,7 +57,7 @@ a:hover.news_foot{ color:#787b7e; border:1px solid #d4d4d4;} .hworkList60 {width:60px; text-align:center;} .hworkList60 {width:60px; text-align:center;} .hworkList70 {width:70px; text-align:center;} -.hworkList80 {width:90px; text-align:center;} +.hworkList80 {width:80px; text-align:center;} .hworkList90 {width:90px; text-align:center;} .hworkList100 {width:100px; text-align:center;} .hworkList110 {width:110px; text-align:center;} From 03bb862e18e5e71397021f81d25e8513dc2aaf35 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 8 Jul 2016 16:55:48 +0800 Subject: [PATCH 02/20] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9F=A5=E9=87=8D?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=B6=88=E6=81=AF=E5=BC=B9=E6=A1=86=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=A0=B7=E5=BC=8F=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/header.css | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/public/stylesheets/header.css b/public/stylesheets/header.css index 92034f843..c0a38d690 100644 --- a/public/stylesheets/header.css +++ b/public/stylesheets/header.css @@ -292,4 +292,18 @@ div.modal { .resourceUploadPopup {width:400px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;} a.Blue-btn{ display:block; margin-right:15px;width:65px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} a:hover.Blue-btn{ background:#3598db; color:#fff;} -/***** end Ajax indicator ******/ +/***** end Ajax indicator ******/ + +/*消息弹框*/ +.shadowbox_news{ width:305px; background-color:#fff; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); position: absolute; left: -131px; top: 45px; z-index: 9999;} +.shadowbox_news_title{ height:40px; line-height:40px;padding-left:10px; font-size:12px; color:#333;border-bottom:1px solid #eee;} +.shadowbox_news_p{ height:40px; line-height:40px; font-size:12px; color:#333;} +.shadowbox_news font{ border: 1px solid #dddddd; display: block; border-width: 8px; position: absolute; top: -15px;left: 140px; border-style:solid; border-color: transparent transparent #fff transparent;font-size: 0;line-height: 0; box-shadow:2px rgba(146, 153, 169, 0.5); } +.shadowbox_news_list{ max-height:400px; overflow:hidden;} +.shadowbox_news_list a{ color:#999;} +.shadowbox_news_list li{ height:40px; border-bottom:1px dashed #ebebeb; line-height:40px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis; padding:0 10px;} +.shadowbox_news_list li:hover{ background-color:#eee;} +span.shadowbox_news_user{ color:#3b94d6;} +a.shadowbox_news_all{ display:block; width:305px; height:40px; line-height:40px; color:#3b94d6; text-align:center;border-top:1px solid #eee;} +.undis {display:none;} +.text_c {text-align:center;} From c7bb53d2bddaf82da9c07cc0c12990f6d0036c8e Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Sat, 9 Jul 2016 13:39:50 +0800 Subject: [PATCH 03/20] =?UTF-8?q?=E5=9C=A8=E6=9C=8D=E5=8A=A1=E7=AB=AF?= =?UTF-8?q?=E5=8A=A0=E4=B8=8Aimagemagick?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + Gemfile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index fe3677396..1ef7e63ce 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ vendor/cache public/javascripts/wechat/node_modules/ .ruby-version .access_token +tmux*.log diff --git a/Gemfile b/Gemfile index afe85df1d..3bea83669 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ unless RUBY_PLATFORM =~ /w32/ gem 'iconv' if RUBY_PLATFORM =~ /darwin/ gem "rmagick", "= 2.15.4" ## osx must be this version - else + elsif RUBY_PLATFORM =~ /linux/ #gem "rmagick", "= 2.13.1" ## centos yum install ImageMagick-devel end gem 'certified' From cb148c3b9c124b6d03a1e88a0f2b1bcd13920dac Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 11 Jul 2016 10:48:44 +0800 Subject: [PATCH 04/20] fixed 500 --- .../quality_analysis_controller.rb | 6 ++-- app/helpers/quality_analysis_helper.rb | 30 +++++++++---------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index db5fac9c7..f59f6df4d 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -213,7 +213,8 @@ class QualityAnalysisController < ApplicationController @quality_analyses = QualityAnalysis.where(:project_id => @project.id).select{|qa| arr.include?(qa.sonar_name)} else filter = "sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,files,functions,classes,directories,blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations" - complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=#{filter}").read + # complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=#{filter}").read + complexity_date = open("http://sonar.trustie.net" + "/api/resources/index?resource=947&depth=0&metrics=#{filter}").read @complexity =JSON.parse(complexity_date).first # 按名称转换成hash键值对 @@ -227,9 +228,6 @@ class QualityAnalysisController < ApplicationController end @ha.store(key,value) end - - issue_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations").read - @sonar_issues = JSON.parse(issue_date).first end rescue => e puts e diff --git a/app/helpers/quality_analysis_helper.rb b/app/helpers/quality_analysis_helper.rb index 2a7d350e7..5940dd255 100644 --- a/app/helpers/quality_analysis_helper.rb +++ b/app/helpers/quality_analysis_helper.rb @@ -3,16 +3,16 @@ module QualityAnalysisHelper def sqale_rating_status val arr = [] - if val < 5 + if val <= 5 arr << "很好" arr << "b_green2" - elsif val. > 5 && val < 10 + elsif val. > 5 && val <= 10 arr << "较好" arr << "b_slow_yellow" - elsif val > 10 && val < 20 + elsif val > 10 && val <= 20 arr << "中等" arr << "b_yellow" - elsif val > 20 && val < 50 + elsif val > 20 && val <= 50 arr << "较差" arr << "b_slow_red" elsif val > 20 @@ -23,10 +23,10 @@ module QualityAnalysisHelper def complexity_status val arr = [] - if val < 10 + if val <= 10 arr << "良好" arr << "b_green2" - elsif val > 10 && val < 15 + elsif val > 10 && val <= 15 arr << "较高" arr << "b_yellow" elsif val > 15 @@ -37,10 +37,10 @@ module QualityAnalysisHelper def duplicated_lines_density_status val arr = [] - if val < 30 + if val <= 30 arr << "良好" arr << "b_green2" - elsif val > 30 && val < 50 + elsif val > 30 && val <= 50 arr << "较高" arr << "b_yellow" elsif val > 50 @@ -51,10 +51,10 @@ module QualityAnalysisHelper def comment_lines_density_status val arr = [] - if val < 20 + if val <= 20 arr << "较低" arr << "b_yellow" - elsif val > 20 && val < 50 + elsif val > 20 && val <= 50 arr << "正常" arr << "b_green2" elsif val > 50 @@ -64,15 +64,15 @@ module QualityAnalysisHelper end def score_sqale_rating val - if val > 0 && val < 5 + if val >= 0 && val <= 5 "5" - elsif val > 5 && val < 10 + elsif val > 5 && val <= 10 "4" - elsif val > 10 && val < 20 + elsif val > 10 && val <= 20 "3" - elsif val > 20 && val < 50 + elsif val > 20 && val <= 50 "2" - elsif val > 20 + elsif val > 50 "1" end end From 831006f3c6af21676764a371601832631aee9e9e Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 11 Jul 2016 10:57:46 +0800 Subject: [PATCH 05/20] css for sqale_index --- app/controllers/quality_analysis_controller.rb | 3 +-- app/views/quality_analysis/_show.html.erb | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index f59f6df4d..a7bf0ef73 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -213,8 +213,7 @@ class QualityAnalysisController < ApplicationController @quality_analyses = QualityAnalysis.where(:project_id => @project.id).select{|qa| arr.include?(qa.sonar_name)} else filter = "sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,files,functions,classes,directories,blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations" - # complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=#{filter}").read - complexity_date = open("http://sonar.trustie.net" + "/api/resources/index?resource=947&depth=0&metrics=#{filter}").read + complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=#{filter}").read @complexity =JSON.parse(complexity_date).first # 按名称转换成hash键值对 diff --git a/app/views/quality_analysis/_show.html.erb b/app/views/quality_analysis/_show.html.erb index 347f33cb5..f36b72d10 100644 --- a/app/views/quality_analysis/_show.html.erb +++ b/app/views/quality_analysis/_show.html.erb @@ -58,17 +58,17 @@ 可定性评价为:质量<%= @ha["sqale_rating"].nil? ? "很好" : sqale_rating_status(@ha["sqale_rating"].to_i)[0] %>
技术债务 - + <% if @ha["sqale_index"].to_i == 0 %> - 0 + 0天 <% else %> <%= /[0-9]*/.match(@ha["sqale_index"])[0] %>天 - <%= / [0-9]*/.match(@ha["sqale_index"]).nil? ? 0 : / [0-9]*/.match(@ha["sqale_index"]) %>小时 + <%= / [0-9]*/.match(@ha["sqale_index"]).nil? ? "" : / [0-9]*/.match(@ha["sqale_index"])+"小时" %> <% end %> 查看详情
-
质量问题 - +
 质量问题 + <%= @ha["violations"].nil? ? 0 : @ha["violations"] %> From bac3e433aad63d10988d8607939b741065b89ba7 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 11 Jul 2016 11:07:04 +0800 Subject: [PATCH 06/20] sqlate index nil --- app/views/quality_analysis/_show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/quality_analysis/_show.html.erb b/app/views/quality_analysis/_show.html.erb index f36b72d10..0f5aebc2d 100644 --- a/app/views/quality_analysis/_show.html.erb +++ b/app/views/quality_analysis/_show.html.erb @@ -63,7 +63,7 @@ 0天 <% else %> <%= /[0-9]*/.match(@ha["sqale_index"])[0] %>天 - <%= / [0-9]*/.match(@ha["sqale_index"]).nil? ? "" : / [0-9]*/.match(@ha["sqale_index"])+"小时" %> + <%= / [0-9]*/.match(@ha["sqale_index"]).nil? ? "" : (/ [0-9]*/.match(@ha["sqale_index"]).to_s + "小时") %> <% end %> 查看详情
From 93e79d9419201bb054e177c23df3dc783639b009 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 11 Jul 2016 11:23:59 +0800 Subject: [PATCH 07/20] add hidden to css --- app/views/quality_analysis/_result_list.html.erb | 8 ++++---- public/stylesheets/project.css | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/views/quality_analysis/_result_list.html.erb b/app/views/quality_analysis/_result_list.html.erb index b0b8abafe..3e2a7d373 100644 --- a/app/views/quality_analysis/_result_list.html.erb +++ b/app/views/quality_analysis/_result_list.html.erb @@ -17,10 +17,10 @@ <% if @quality_analyses.count >0 %> <% @quality_analyses.each do |qa| %>
    -
  • <%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.sonar_name, :branch => (qa.branch.nil? ? "master" : qa.branch)), :class => "analysis-result-name fl fontBlue2" %>
  • -
  • <%= qa.branch %>
  • -
  • <%= qa.language %>
  • -
  • <%= qa.path %>
  • +
  • <%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.sonar_name, :branch => (qa.branch.nil? ? "master" : qa.branch)), :class => "analysis-result-name fl fontBlue2 hidden" %>
  • + + + <% if User.current.try(:login) == qa.author_login %>
  • <%=link_to "编辑", edit_project_quality_analysi_path(qa, :project_id => @project.id), :remote => true, :class => "fontBlue2" %> diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index bde560613..9a3ba2e47 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -1273,11 +1273,11 @@ a.pages-big{ width:50px;} .analysis-result-list {padding:5px;} .analysis-result-list:nth-of-type(odd){background:#fff;}/*奇数行*/ .analysis-result-list:nth-of-type(even){background:#f5f5f5;}/*偶数行*/ -.analysis-result-name {width:200px; cursor:pointer;} -.analysis-result-version {width:90px; text-align:right; cursor:pointer;} -.analysis-result-loc {width:60px; text-align:right; cursor:pointer;} -.analysis-result-debt {width:160px; text-align:right; cursor:pointer;} -.analysis-result-time {width:150px; text-align:right; cursor:pointer;} +.analysis-result-name {width:200px;} +.analysis-result-version {width:90px; text-align:right;} +.analysis-result-loc {width:60px; text-align:right;} +.analysis-result-debt {width:160px; text-align:right;} +.analysis-result-time {width:150px; text-align:right;} .analysis-name-icon {background:url(../images/code-analysis-icon.png) -2px -148px no-repeat; width:16px; height:16px; display:inline-block; vertical-align:middle;} /*未登录回复提示*/ From 0a001b4f768a3b026d2fabdcbdf25948f8d9a3db Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 11 Jul 2016 11:29:15 +0800 Subject: [PATCH 08/20] message 500 for boliang --- app/views/users/_join_course_course_message.html.erb | 2 +- app/views/users/_user_message_course.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/users/_join_course_course_message.html.erb b/app/views/users/_join_course_course_message.html.erb index 01ebb5cf9..c7d1157f9 100644 --- a/app/views/users/_join_course_course_message.html.erb +++ b/app/views/users/_join_course_course_message.html.erb @@ -18,7 +18,7 @@

    真实姓名:<%= User.find(ma.course_message_id).realname %>

    申请课程:<%= Course.find(ma.course_id).name%>

    课程描述:
    -
    <%= Course.find(ma.course_id).description.html_safe %>
    +
    <%= Course.find(ma.course_id).description %>

    申请职位:<%= ma.content == '9' ? "教师" : "教辅"%>

  • diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index f48ce7010..5702d61d1 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -569,7 +569,7 @@
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> - <% if ma.course_message_type == "JoinCourseRequest" %> + <% if ma.course_message_type == "JoinCourseRequest" && !ma.nil? %>
      <%= render :partial => 'join_course_course_message', :locals => {:ma => ma} %>
    From 834e72b0f8452b98c7b5f2708220ec5776eb2199 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 11 Jul 2016 14:43:22 +0800 Subject: [PATCH 09/20] =?UTF-8?q?=E6=9C=AA=E9=85=8D=E7=BD=AE=E7=8F=AD?= =?UTF-8?q?=E7=BA=A7=E5=88=97=E8=A1=A8=E6=8A=A5500=EF=BC=8C=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E7=8F=AD=E7=BA=A7=E5=88=97=E8=A1=A8=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=88=97=E8=A1=A8=E6=98=8E=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=B7=B2=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 4 ++-- app/views/admin/_courselist_detail_tr.html.erb | 4 +++- app/views/admin/courses.html.erb | 9 +++++++-- app/views/admin/non_syllabus_courses.html.erb | 4 +++- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index bc764d034..be622b919 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -112,10 +112,10 @@ class AdminController < ApplicationController def non_syllabus_courses @name = params[:name].to_s.strip.downcase if @name && @name != "" - @courses = Course.where("syllabus_id is null").select{ |course| (course.teacher[:lastname].to_s.downcase + course.teacher[:firstname].to_s.downcase).include?(@name) || course.name.include?(@name)} + @courses = Course.where("syllabus_id is null and is_delete = 0").select{ |course| (course.teacher[:lastname].to_s.downcase + course.teacher[:firstname].to_s.downcase).include?(@name) || course.name.include?(@name)} @courses = @courses.sort{|x, y| y.created_at <=> x.created_at} else - @courses = Course.where("syllabus_id is null").order('created_at desc') + @courses = Course.where("syllabus_id is null and is_delete = 0").order('created_at desc') end @courses = paginateHelper @courses,30 @page = (params['page'] || 1).to_i - 1 diff --git a/app/views/admin/_courselist_detail_tr.html.erb b/app/views/admin/_courselist_detail_tr.html.erb index 07486faa3..bc1eebeed 100644 --- a/app/views/admin/_courselist_detail_tr.html.erb +++ b/app/views/admin/_courselist_detail_tr.html.erb @@ -7,7 +7,7 @@ - <%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %> + <%= link_to(course.teacher.show_name.truncate(6, omission: '...'), user_path(course.teacher)) %> <%= course.class_period %> @@ -16,6 +16,8 @@ <%= checked_image course.is_public? %> + <%= course.is_delete == 0 ? '正常' : '归档' %> + <%= format_date(course.created_at) %> diff --git a/app/views/admin/courses.html.erb b/app/views/admin/courses.html.erb index 11fb1973f..8695bc6b9 100644 --- a/app/views/admin/courses.html.erb +++ b/app/views/admin/courses.html.erb @@ -27,10 +27,10 @@ - - + @@ -58,9 +61,11 @@ <% @courses.each do |course| %> + <% unless course.teacher.nil? %> " id="course_<%=course.id %>"> <%=render :partial => 'courselist_detail_tr', :locals => {:course => course} %> + <% end %> <% end %>
    + 序号 + 班级 @@ -42,6 +42,9 @@ <%=l(:field_is_public)%> + 状态 + <%=l(:field_created_on)%>
    diff --git a/app/views/admin/non_syllabus_courses.html.erb b/app/views/admin/non_syllabus_courses.html.erb index 6c3cbec10..6cde56675 100644 --- a/app/views/admin/non_syllabus_courses.html.erb +++ b/app/views/admin/non_syllabus_courses.html.erb @@ -58,6 +58,7 @@ <% @courses.each do |course| %> + <% unless course.teacher.nil? %> " id="course_<%=course.id %>"> <%= course.id %> @@ -68,7 +69,7 @@ - <%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %> + <%= link_to(course.teacher.show_name.truncate(6, omission: '...'), user_path(course.teacher)) %> <%= course.class_period %> @@ -90,6 +91,7 @@ <% end %> + <% end %>
    From 5d9bde3c95b973a2ad52a9c6156e129ab1d8ffd9 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 11 Jul 2016 15:10:55 +0800 Subject: [PATCH 10/20] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=8F=91=E9=80=81?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=88=B0=E8=AF=BE=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- app/views/users/_resource_share_popup.html.erb | 4 ++-- app/views/users/_send_homework_to_course.html.erb | 4 ++-- app/views/users/_share_message_to_course.html.erb | 2 +- app/views/users/_share_news_to_course.html.erb | 2 +- lib/tasks/update_homework.rake | 12 +++++++++--- public/javascripts/application.js | 2 +- 7 files changed, 17 insertions(+), 11 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 3f23d94dc..83a794cd9 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2023,7 +2023,7 @@ class UsersController < ApplicationController @flag = true if params[:send_id].present? rs = ResourcesService.new - @ori, @flag, @save_message = rs.send_resource_to_course(params) + @ori, @flag, @save_message = rs.send_resource_to_course(User.current, params) elsif params[:send_ids].present? send_ids = params[:send_ids].split(",") course_ids = params[:course_ids] diff --git a/app/views/users/_resource_share_popup.html.erb b/app/views/users/_resource_share_popup.html.erb index 68c059a1d..47a84481b 100644 --- a/app/views/users/_resource_share_popup.html.erb +++ b/app/views/users/_resource_share_popup.html.erb @@ -8,7 +8,7 @@ <% send_ids = send_ids.class == String ? send_ids : send_ids.join(",") %> <% end %> @@ -20,7 +20,7 @@ <%= form_tag search_user_course_user_path(user),:method => 'get', :remote=>true, :id=> 'search_user_course_form', :class=> 'resourcesSearchBox' do %> <%= hidden_field_tag(:send_id, send_id) %> <%= hidden_field_tag(:send_ids, send_ids) %> - + diff --git a/app/views/users/_send_homework_to_course.html.erb b/app/views/users/_send_homework_to_course.html.erb index 67fd36c3c..fc4007d03 100644 --- a/app/views/users/_send_homework_to_course.html.erb +++ b/app/views/users/_send_homework_to_course.html.erb @@ -5,8 +5,8 @@
    - - + +
    <%= render :partial => "users/send_homework_to_course_form", :locals => {:user => user, :courses => courses, :send_id => send_id} %> diff --git a/app/views/users/_share_message_to_course.html.erb b/app/views/users/_share_message_to_course.html.erb index 66d44739c..d86c51f0d 100644 --- a/app/views/users/_share_message_to_course.html.erb +++ b/app/views/users/_share_message_to_course.html.erb @@ -18,7 +18,7 @@ :remote=>true,:id=>'search_user_course_form',:class=>'resourcesSearchBox' do %> <%= hidden_field_tag(:send_id, send_id) %> <%= hidden_field_tag(:send_ids, send_ids) %> - + diff --git a/app/views/users/_share_news_to_course.html.erb b/app/views/users/_share_news_to_course.html.erb index a1a0d6e39..e03a296b2 100644 --- a/app/views/users/_share_news_to_course.html.erb +++ b/app/views/users/_share_news_to_course.html.erb @@ -18,7 +18,7 @@ :remote=>true,:id=>'search_user_course_form',:class=>'resourcesSearchBox' do %> <%= hidden_field_tag(:send_id, send_id) %> <%= hidden_field_tag(:send_ids, send_ids) %> - + diff --git a/lib/tasks/update_homework.rake b/lib/tasks/update_homework.rake index 3592fe985..7c550b673 100644 --- a/lib/tasks/update_homework.rake +++ b/lib/tasks/update_homework.rake @@ -15,10 +15,13 @@ namespace :update_homework do unless student_works.nil? student_works.each do |s| project = Project.find s.project_id - unless project.nil? && project.gpid.nil? + unless project.nil? && project.gpid.blank? project_time=project.updated_on project_time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last - if time.strftime('%Y-%m-%d %H:%M:%S') < project_time.strftime('%Y-%m-%d %H:%M:%S') + puts "the time is =========================> #{time}" + puts "the project_time is =========================> #{project_time}" + #if time.strftime('%Y-%m-%d %H:%M:%S') < project_time.strftime('%Y-%m-%d %H:%M:%S') + if format_time(time) < format_time(project_time) time = project_time end begin @@ -28,7 +31,10 @@ namespace :update_homework do changesets = g.commits(project.gpid, :ref_name => default_branch) changesets_latest_coimmit = changesets[0] unless changesets[0].blank? - if time.strftime('%Y-%m-%d %H:%M:%S') #{time}" + puts "the changesets_latest_coimmit is =========================> #{changesets_latest_coimmit.created_at}" + #if time.strftime('%Y-%m-%d %H:%M:%S') < changesets_latest_coimmit.created_at.strftime('%Y-%m-%d %H:%M:%S') + if format_time(time) < format_time(changesets_latest_coimmit.created_at) time = changesets_latest_coimmit.created_at end end diff --git a/public/javascripts/application.js b/public/javascripts/application.js index c2ae2733d..a342a9608 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1601,7 +1601,7 @@ function expand_course_list(id, target, btnid, count) { target.show(); }else{ btn.data('init',0); - btn.html('共'+count+ '个课程,点击全部展开'); + btn.html('共'+count+ '个班级,点击全部展开'); target.hide(); target.eq(0).show(); target.eq(1).show(); From 0b4db9775646d0ad32e7d3b789a7cbadc4483702 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 11 Jul 2016 15:15:38 +0800 Subject: [PATCH 11/20] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E5=8A=A8=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index bc764d034..125b2b97e 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -61,7 +61,7 @@ class AdminController < ApplicationController if params[:syllabus_id] && params[:course_id] course = Course.where("id = #{params[:course_id].to_i}").first unless course.nil? - course.update_attribute('syllabus_id', params[:syllabus_id].to_i) + course.update_column('syllabus_id', params[:syllabus_id].to_i) @flag = true end end @@ -124,11 +124,11 @@ class AdminController < ApplicationController end end - #修改课程名称 + #修改班级名称 def update_course_name @course = Course.where("id = #{params[:course_id].to_i}").first unless @course.nil? - @course.update_attribute("name", params[:name]) + @course.update_column("name", params[:name]) respond_to do |format| format.js end From d21eaf91545f5b6d298405a9b61c5ff3fd24e458 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 11 Jul 2016 15:32:01 +0800 Subject: [PATCH 12/20] =?UTF-8?q?=E6=9C=AA=E9=85=8D=E7=BD=AE=E7=8F=AD?= =?UTF-8?q?=E7=BA=A7=E5=88=97=E8=A1=A8=E7=9A=84=E7=8F=AD=E7=BA=A7=E9=87=8D?= =?UTF-8?q?=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admin/_courselist_detail_tr.html.erb | 3 ++- app/views/admin/non_syllabus_courses.html.erb | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/views/admin/_courselist_detail_tr.html.erb b/app/views/admin/_courselist_detail_tr.html.erb index bc1eebeed..83b7904ce 100644 --- a/app/views/admin/_courselist_detail_tr.html.erb +++ b/app/views/admin/_courselist_detail_tr.html.erb @@ -17,7 +17,8 @@ <%= course.is_delete == 0 ? '正常' : '归档' %> - + + <%= format_date(course.created_at) %> diff --git a/app/views/admin/non_syllabus_courses.html.erb b/app/views/admin/non_syllabus_courses.html.erb index 6cde56675..1be979eeb 100644 --- a/app/views/admin/non_syllabus_courses.html.erb +++ b/app/views/admin/non_syllabus_courses.html.erb @@ -27,10 +27,10 @@ - - + @@ -63,7 +66,7 @@ - + From 8b5a2ac1cb53847da11ce3e7b22c33b0215bea45 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 11 Jul 2016 16:59:37 +0800 Subject: [PATCH 13/20] message 500 --- .../quality_analysis_controller.rb | 2 +- app/views/quality_analysis/index.html.erb | 10 +--- app/views/users/_user_message_course.html.erb | 48 +++++++++---------- 3 files changed, 26 insertions(+), 34 deletions(-) diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index a7bf0ef73..ae752f6b9 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -114,7 +114,7 @@ class QualityAnalysisController < ApplicationController end end rescue => e - puts e + @message = e.message end respond_to do |format| if @current_build_status == "success" diff --git a/app/views/quality_analysis/index.html.erb b/app/views/quality_analysis/index.html.erb index 7925f6120..06455cebe 100644 --- a/app/views/quality_analysis/index.html.erb +++ b/app/views/quality_analysis/index.html.erb @@ -1,14 +1,6 @@ <% if @name_flag %> <%= render :partial => "result_list" %> <% else %> - <% if params[:current_build_status].nil? || params[:current_build_status] == "success" %> - <%= render :partial => "show", :locals => {:branch => @branch} %> - <% else %> - <% if params[:build_console_result] %> - 运行结果超时 - <% else %> - <%= render :partial => "console_output" %> - <% end %> - <% end %> + <%= render :partial => "show", :locals => {:branch => @branch} %> <% end %> diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 5702d61d1..93d55d162 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -1,5 +1,5 @@ <% if ma.class == CourseMessage %> - <% if ma.course_message_type == "News" %> + <% if ma.course_message_type == "News" && ma.course_message %> <% end %> - <% if ma.course_message_type == "Comment" %> + <% if ma.course_message_type == "Comment" && ma.course_message %> <% end %> - <% if ma.course_message_type == "HomeworkCommon" && ma.status.nil?%> + <% if ma.course_message_type == "HomeworkCommon" && ma.status.nil? && ma.course_message %> <% end %> - <% if ma.course_message_type == "HomeworkCommon" && ma.status == 1 %> + <% if ma.course_message_type == "HomeworkCommon" && ma.status == 1 && ma.course_message %> <% end %> - <% if ma.course_message_type == "HomeworkCommon" && ma.status == 2 %> + <% if ma.course_message_type == "HomeworkCommon" && ma.status == 2 && ma.course_message %> <% end %> - <% if ma.course_message_type == "HomeworkCommon" && ma.status == 3 %> + <% if ma.course_message_type == "HomeworkCommon" && ma.status == 3 && ma.course_message %> <% end %> - <% if ma.course_message_type == "HomeworkCommon" && ma.status == 4 %> + <% if ma.course_message_type == "HomeworkCommon" && ma.status == 4 && ma.course_message %> <% end %> - <% if ma.course_message_type == "HomeworkCommon" && ma.status == 5 %> + <% if ma.course_message_type == "HomeworkCommon" && ma.status == 5 && ma.course_message %>
      <%= render :partial => 'apply_homework_course_message', :locals => {:ma => ma} %>
    <% end %> - <% if ma.course_message_type == "ApplyResource" && ma.status == 0 %> + <% if ma.course_message_type == "ApplyResource" && ma.status == 0 && ma.course_message %>
      <%= render :partial => 'apply_resource_course_message', :locals => {:ma => ma} %>
    <% end %> - <% if ma.course_message_type == "ApplyResource" && ma.status == 1 %> + <% if ma.course_message_type == "ApplyResource" && ma.status == 1 && ma.course_message %>
      <%= render :partial => 'apply_resource_course_message_reply', :locals => {:ma => ma} %>
    <% end %> - <% if ma.course_message_type == "HomeworkCommon" && ma.status == 6 %> + <% if ma.course_message_type == "HomeworkCommon" && ma.status == 6 && ma.course_message %> <% end %> - <% if ma.course_message_type == "Poll" %> + <% if ma.course_message_type == "Poll" && ma.course_message %> <% end %> - <% if ma.course_message_type == "Message" %> + <% if ma.course_message_type == "Message" && !ma.nil? && !ma.course_message.nil? %> <% end %> - <% if ma.course_message_type == "JournalsForMessage" %> + <% if ma.course_message_type == "JournalsForMessage" && ma.course_message %> <% if ma.course_message.jour_type == 'Course' %> <% if params[:type] != 'homework' %>
      @@ -459,7 +459,7 @@ <% end %> <% end %> - <% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? && !User.current.allowed_to?(:as_teacher, ma.course_message.homework_common.course) %> + <% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? && !User.current.allowed_to?(:as_teacher, ma.course_message.homework_common.course) && ma.course_message %>
      • <%= link_to image_tag(url_to_avatar(ma.course_message.homework_common.user), :width => "30", :height => "30"), user_path(ma.course_message.homework_common.user), :target => '_blank' %>
      • @@ -493,7 +493,7 @@ <% end %> - <% if ma.course_message_type == "StudentWork" && ma.status == 1 %> + <% if ma.course_message_type == "StudentWork" && ma.status == 1 && ma.course_message %> <% end %> - <% if ma.course_message_type == "StudentWork" && ma.status == 2 %> + <% if ma.course_message_type == "StudentWork" && ma.status == 2 && ma.course_message %> <% end %> - <% if ma.course_message_type == "Course" %> + <% if ma.course_message_type == "Course" && ma.course_message %> <% end %> - <% if ma.course_message_type == "JoinCourseRequest" && !ma.nil? %> + <% if ma.course_message_type == "JoinCourseRequest" && !ma.nil? && ma.course_message %>
          <%= render :partial => 'join_course_course_message', :locals => {:ma => ma} %>
        @@ -607,7 +607,7 @@ <% end %> - <% if ma.course_message_type == "JoinCourse" and ma.status == 0 %> + <% if ma.course_message_type == "JoinCourse" and ma.status == 0 && ma.course_message %>
        • <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id), :target => '_blank' %> @@ -641,7 +641,7 @@ <% end %> - <% if ma.course_message_type == "JoinCourse" and ma.status == 1 %> + <% if ma.course_message_type == "JoinCourse" and ma.status == 1 && ma.course_message %>
          • @@ -675,7 +675,7 @@ <% end %> - <% if ma.course_message_type == "RemoveFromCourse" %> + <% if ma.course_message_type == "RemoveFromCourse" && ma.course_message %>
            • <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id), :target => '_blank' %> @@ -710,7 +710,7 @@ <% end %> - <% if ma.course_message_type == "Exercise" && ma.status == 2 %> + <% if ma.course_message_type == "Exercise" && ma.status == 2 && ma.course_message %> <% end %> - <% if ma.course_message_type == "JoinCourseRequest" && !ma.nil? && ma.course_message %> + + + <% if ma.course_message_type == "JoinCourseRequest" && !ma.nil? %>
                <%= render :partial => 'join_course_course_message', :locals => {:ma => ma} %>
              @@ -607,7 +609,7 @@ <% end %> - <% if ma.course_message_type == "JoinCourse" and ma.status == 0 && ma.course_message %> + <% if ma.course_message_type == "JoinCourse" and ma.status == 0 %>
              • <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id), :target => '_blank' %> @@ -641,7 +643,7 @@ <% end %> - <% if ma.course_message_type == "JoinCourse" and ma.status == 1 && ma.course_message %> + <% if ma.course_message_type == "JoinCourse" and ma.status == 1 %>
                • @@ -675,7 +677,7 @@ <% end %> - <% if ma.course_message_type == "RemoveFromCourse" && ma.course_message %> + <% if ma.course_message_type == "RemoveFromCourse" %>
                  • <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id), :target => '_blank' %> From 66c40ba1398d346bf1b16509f6064eb749ad04f0 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 12 Jul 2016 09:41:00 +0800 Subject: [PATCH 15/20] =?UTF-8?q?=E5=8A=A8=E6=80=81=E7=9A=84=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/update_homework.rake | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/tasks/update_homework.rake b/lib/tasks/update_homework.rake index 7c550b673..d97004c8c 100644 --- a/lib/tasks/update_homework.rake +++ b/lib/tasks/update_homework.rake @@ -20,8 +20,8 @@ namespace :update_homework do project_time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last puts "the time is =========================> #{time}" puts "the project_time is =========================> #{project_time}" - #if time.strftime('%Y-%m-%d %H:%M:%S') < project_time.strftime('%Y-%m-%d %H:%M:%S') - if format_time(time) < format_time(project_time) + if time.strftime('%Y-%m-%d %H:%M:%S') < project_time.strftime('%Y-%m-%d %H:%M:%S') + #if format_time(time) < format_time(project_time) time = project_time end begin @@ -33,9 +33,10 @@ namespace :update_homework do unless changesets[0].blank? puts "the time is =========================> #{time}" puts "the changesets_latest_coimmit is =========================> #{changesets_latest_coimmit.created_at}" - #if time.strftime('%Y-%m-%d %H:%M:%S') < changesets_latest_coimmit.created_at.strftime('%Y-%m-%d %H:%M:%S') - if format_time(time) < format_time(changesets_latest_coimmit.created_at) - time = changesets_latest_coimmit.created_at + puts "the distance time is =========================> #{changesets_latest_coimmit.created_at.to_time > Time.now}" + if time.strftime('%Y-%m-%d %H:%M:%S') < changesets_latest_coimmit.created_at.to_time.strftime('%Y-%m-%d %H:%M:%S') + #if format_time(time) < format_time(changesets_latest_coimmit.created_at) + time = changesets_latest_coimmit.created_at.to_time end end rescue Exception => e From 8df0dcae7abc00fc619eb83c689e94f0278a146a Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 12 Jul 2016 16:35:06 +0800 Subject: [PATCH 16/20] =?UTF-8?q?=E8=B0=83=E7=94=A8=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=B8=8D=E6=88=90=E5=8A=9F=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E5=85=B7=E4=BD=93=E7=9A=84=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 4c3a608de..926eac67c 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -110,9 +110,9 @@ class StudentWorkController < ApplicationController #status 0:答案正确 -5program_test_ex 函数出错 -4judge代码出错 -3http超时 -2:编译错误 -1:答案错误 2:程序运行超时 resultObj[:status] = -3 CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>-3,:wait_time=>tUsedtime,:student_work_id=>student_work.id) - rescue + rescue => e #-4 judge代码 出错 - logger.debug "program_test_error 1" + logger.debug "program_test_error #{e}" resultObj[:status] = -4 tmpstatus = -4 CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>tmpstatus,:time_used=>0,:wait_time=>0,:student_work_id=>student_work.id) From 4908a68a7d4e2bcb37f6107e10bc858b8f488107 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 12 Jul 2016 16:49:15 +0800 Subject: [PATCH 17/20] =?UTF-8?q?=E6=97=B6=E9=97=B4utc=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile~ | 114 --------------------- app/controllers/student_work_controller.rb | 2 +- 2 files changed, 1 insertion(+), 115 deletions(-) delete mode 100644 Gemfile~ diff --git a/Gemfile~ b/Gemfile~ deleted file mode 100644 index 334f15853..000000000 --- a/Gemfile~ +++ /dev/null @@ -1,114 +0,0 @@ -source 'https://ruby.taobao.org/' - -unless RUBY_PLATFORM =~ /w32/ - # unix-like only - gem 'iconv' - gem "rmagick", ">= 2.0.0" - gem 'certified' -end - -gem 'net-ssh', '2.9.1' -gem 'jenkins_api_client' -gem 'nokogiri' - -gem 'wechat',path: 'lib/wechat' -gem 'grack', path:'lib/grack' -gem 'gitlab', path: 'lib/gitlab-cli' -gem 'rest-client' -gem "mysql2", "= 0.3.18" -gem 'redis-rails' -gem 'rubyzip' -gem 'delayed_job_active_record'#, :group => :production -gem 'daemons' -gem 'grape', '~> 0.9.0' -gem 'grape-entity' -gem 'rack-cors', :require => 'rack/cors' -gem 'seems_rateable', '~> 1.0.13' -gem 'rails', '~> 3.2' -gem "jquery-rails", "~> 2.0.2" -gem "i18n", "~> 0.6.0" -gem 'coderay', '~> 1.1.0' -gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby] -gem "builder", "3.0.0" -gem 'acts-as-taggable-on', '2.4.1' -gem 'spreadsheet' -gem 'ruby-ole' -gem 'rails_kindeditor',path:'lib/rails_kindeditor' -gem 'binding_of_caller' -gem 'chinese_pinyin' -# gem 'sunspot_rails', '~> 1.3.3' -# gem 'sunspot_solr' -# gem 'sunspot' -# gem 'progress_bar' -gem 'ansi' - -gem 'kaminari' -gem 'elasticsearch-model' -gem 'elasticsearch-rails' - - -### profile -#gem 'oneapm_rpm' - -group :development do - gem 'grape-swagger' - gem 'better_errors', '~> 1.1.0' - # gem "query_reviewer" - # gem 'rack-mini-profiler', '~> 0.9.3' - if RUBY_PLATFORM =~ /w32/ - gem 'win32console' - end -end - -group :development, :test do - unless RUBY_PLATFORM =~ /w32/ - gem 'pry-rails' - if RUBY_VERSION >= '2.0.0' - gem 'pry-byebug' - end - gem 'pry-stack_explorer' - if RUBY_PLATFORM =~ /darwin/ - gem 'puma' - end - end - - gem 'rspec-rails', '~> 3.0' - gem 'factory_girl_rails' -end - -# Gems used only for assets and not required -# in production environments by default. -group :assets do - gem 'sass-rails', '~> 3.2.3' - gem 'coffee-rails', '~> 3.2.1' - - # See https://github.com/sstephenson/execjs#readme for more supported runtimes - # gem 'therubyracer', :platforms => :ruby - - gem 'uglifier', '>= 1.0.3' -end - -# Optional gem for LDAP authentication -group :ldap do - gem "net-ldap", "~> 0.3.1" -end - - -# Optional gem for OpenID authentication -group :openid do - gem "ruby-openid", "~> 2.1.4", :require => "openid" - gem "rack-openid" -end - - -database_file = File.join(File.dirname(__FILE__), "config/database.yml") -if File.exist?(database_file) -else - warn("Please configure your config/database.yml first") -end - -# Load plugins' Gemfiles -Dir.glob File.expand_path("../plugins/*/Gemfile", __FILE__) do |file| - puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v` - instance_eval File.read(file) -end diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 926eac67c..bc1b97a2f 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -197,7 +197,7 @@ class StudentWorkController < ApplicationController resultObj[:status] = 0 end student_work.save! - resultObj[:time] = student_work_test.created_at.to_s(:db) + resultObj[:time] = student_work_test.created_at.strftime(format='%Y-%m-%d %H:%M:%S') resultObj[:index] = student_work.student_work_tests.count end From b4ac13c157bb990f01f234e5ef391b743838617d Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Wed, 13 Jul 2016 09:36:43 +0800 Subject: [PATCH 18/20] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E7=A8=8B?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=B2=A1main=E5=87=BD=E6=95=B0=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E8=AF=84=E5=88=86100=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/student_work_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/student_work_test.rb b/app/models/student_work_test.rb index 54d5ab07a..f2a35871f 100644 --- a/app/models/student_work_test.rb +++ b/app/models/student_work_test.rb @@ -45,7 +45,7 @@ class StudentWorkTest < ActiveRecord::Base private def get_success_count self.results.inject(0) do |sum, result| - sum += (result["status"] && result["status"].to_i == 0 ? 1 : 0) + sum += (result["status"] && result["status"].class == ::Fixnum && result["status"].to_i == 0 ? 1 : 0) end || 0 end From 8c2ae92d310da606e2fa136e364e75d86ce6314f Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 15 Jul 2016 14:45:01 +0800 Subject: [PATCH 19/20] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=80=A7=E8=83=BD?= =?UTF-8?q?=E5=88=86=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 +- config/menu.yml.test | 9 +++------ config/oneapm.yml | 4 ++-- config/wechat.yml | 8 ++++---- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/Gemfile b/Gemfile index 3bea83669..03dbb5785 100644 --- a/Gemfile +++ b/Gemfile @@ -51,7 +51,7 @@ gem 'elasticsearch-rails' ### profile -#gem 'oneapm_rpm' +gem 'oneapm_rpm' group :development do gem 'grape-swagger' diff --git a/config/menu.yml.test b/config/menu.yml.test index a163bac61..a43d72816 100644 --- a/config/menu.yml.test +++ b/config/menu.yml.test @@ -2,21 +2,18 @@ button: - type: "view" name: "我的动态" - url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=http://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_b -ase&state=activities#wechat_redirect" + url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://ucloudtest.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=activities#wechat_redirect" - name: "我的课程" sub_button: - type: "view" name: "课程" - url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=http://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi -_base&state=class_list#wechat_redirect" + url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://ucloudtest.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=class_list#wechat_redirect" - type: "view" name: "资源" - url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=http://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi -_base&state=myresource#wechat_redirect" + url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://ucloudtest.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=myresource#wechat_redirect" - name: "更多" diff --git a/config/oneapm.yml b/config/oneapm.yml index 7e85a3c65..3ab2385f5 100644 --- a/config/oneapm.yml +++ b/config/oneapm.yml @@ -11,7 +11,7 @@ common: &default_settings # 如果您修改了此处的app_name,一个新的应用会出现在后台, # 数据会上传到这个新应用,并停止向旧的应用上传数据。 # - app_name: trustie + app_name: trustie_wechat # # 环境相关配置 @@ -25,7 +25,7 @@ development: <<: *default_settings # development模式下,探针开启并上传性能数据 monitor_mode: true - app_name: trustie(Development) + app_name: My Application (Development) test: <<: *default_settings diff --git a/config/wechat.yml b/config/wechat.yml index d243ca44c..5740be9a6 100644 --- a/config/wechat.yml +++ b/config/wechat.yml @@ -8,12 +8,12 @@ default: &default #secret: "743e038392f1d89540e95f8f7645849a" #production - appid: "wx8e1ab05163a28e37" - secret: "beb4d3bc4b32b3557811680835357841" + #appid: "wx8e1ab05163a28e37" + #secret: "beb4d3bc4b32b3557811680835357841" #test - #appid: "wxc09454f171153c2d" - #secret: "dff5b606e34dcafe24163ec82c2715f8" + appid: "wxc09454f171153c2d" + secret: "dff5b606e34dcafe24163ec82c2715f8" token: "123456" access_token: "1234567" From dd892993dd2027e3ef982e30bf9cf30c7e4bc22b Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 15 Jul 2016 14:49:23 +0800 Subject: [PATCH 20/20] assets --- app/views/wechats/user_activities.html.erb | 52 +++++++++++----------- public/javascripts/wechat/build/app.min.js | 8 ++-- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/app/views/wechats/user_activities.html.erb b/app/views/wechats/user_activities.html.erb index f724be392..5e86d32d1 100644 --- a/app/views/wechats/user_activities.html.erb +++ b/app/views/wechats/user_activities.html.erb @@ -27,32 +27,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/javascripts/wechat/build/app.min.js b/public/javascripts/wechat/build/app.min.js index 7e4e69008..6511ffb0e 100644 --- a/public/javascripts/wechat/build/app.min.js +++ b/public/javascripts/wechat/build/app.min.js @@ -1,7 +1,7 @@ var app=angular.module("wechat",["ngRoute"]);app.constant("config",{rootPath:"/assets/wechat/",rootUrl:"/",apiUrl:"/api/v1/"}),app.run(["$rootScope","auth","$location","$routeParams",function(t,a,e,r){g_redirect_path&&g_redirect_path.length>1&&(e.path(g_redirect_path),g_redirect_path=null),t.$on("$routeChangeError",function(t,a,r){a&&a.templateUrl&&(a.templateUrl.endsWith("login.html")||a.templateUrl.endsWith("reg.html")||e.path("/login"))}),t.$on("$routeChangeStart",function(t,a,e){})}]); -app.factory("alertService",function(){function t(){this.title=null,this.message=null,this.visible=null,this.cb=null}return t.prototype.showMessage=function(t,e,n){this.message=e,this.title=t,this.visible=!0,this.cb=n},t.prototype.dismiss=function(){this.message=null,this.title=null,this.visible=!1,this.cb&&this.cb()},{create:function(){return new t}}}),app.factory("auth",["$http","$routeParams","$q","session","config",function(t,e,n,o,a){var i=function(){var a=n.defer(),i=c();if(i&&i.length>10)a.resolve(i);else{window.g_code||e.code||o.get("code");t.post("/wechat/get_bind",{}).then(function(t){0!=t.data.status?a.reject(t.data.message):(o.save("token",t.data.token),a.resolve(t.data.token))})["catch"](function(t){a.reject(t)})}return a.promise},c=function(){return o.get("token")};return{get_bind:i,token:c}}]),app.factory("session",function(){return{save:function(t,e){sessionStorage.setItem(t,e)},get:function(t){return sessionStorage.getItem(t)}}}),app.factory("rms",function(){var t={},e=function(e,n){t[e]=n},n=function(e){return t[e]};return{save:e,get:n}}),app.factory("common",["$http","auth","$routeParams",function(t,e,n){var o=function(n,o,a,i){if(a.comment&&!(a.comment.length<=0)){var c=a.comment.replace(/\n/g,"
                    "),s={type:o,content:c,token:e.token()};a.disabled=!0,t({method:"POST",url:apiUrl+"new_comment/"+n,data:s}).then(function(t){a.disabled=!1,"function"==typeof i&&i()},function(t){})}},a=function(n,o){return t({method:"GET",url:apiUrl+o+"/"+n+"?token="+e.token()})},i=function(n){n.praise_count+=1,n.has_praise=!0,t({method:"POST",url:apiUrl+"praise/"+n.act_id,data:{token:e.token(),type:n.act_type}}).then(function(t){console.log(t.data)},function(t){})},c=function(n){n.praise_count-=1,n.has_praise=!1,t({method:"POST",url:apiUrl+"praise/"+n.act_id,data:{token:e.token(),type:n.act_type}}).then(function(t){console.log(t.data)},function(t){})},s=function(t){t.scope.formData={comment:""};var e=function(e){a(e,t.type).then(function(e){t.loadCallback(e.data)},function(t){})};e(t.id),t.scope.addReply=function(n){console.log(n.comment),o(t.id,t.replyType,n,function(){t.scope.formData={comment:""},e(t.id),"function"==typeof t.replyCallback&&t.replyCallback()})},t.scope.addPraise=i,t.scope.decreasePraise=c};return{init:s,addCommonReply:o,loadCommonData:a,addCommonPraise:i,decreaseCommonPraise:c}}]); +app.factory("alertService",function(){function t(){this.title=null,this.message=null,this.visible=null,this.cb=null}return t.prototype.showMessage=function(t,i,e){this.message=i,this.title=t,this.visible=!0,this.cb=e},t.prototype.dismiss=function(){this.message=null,this.title=null,this.visible=!1,this.cb&&this.cb()},{create:function(){return new t}}}),app.factory("auth",["$http","$routeParams","$q","session","config",function(t,i,e,a,c){var s=function(){var c=e.defer(),s=o();if(s&&s.length>10)c.resolve(s);else{window.g_code||i.code||a.get("code");t.post("/wechat/get_bind",{}).then(function(t){0!=t.data.status?c.reject(t.data.message):(a.save("token",t.data.token),c.resolve(t.data.token))})["catch"](function(t){c.reject(t)})}return c.promise},o=function(){return a.get("token")};return{get_bind:s,token:o}}]),app.factory("session",function(){return{save:function(t,i){sessionStorage.setItem(t,i)},get:function(t){return sessionStorage.getItem(t)}}}),app.factory("rms",function(){var t={},i=function(i,e){t[i]=e},e=function(i){return t[i]};return{save:i,get:e}}),app.factory("common",["$http","auth","$routeParams","rms",function(t,i,e,a){var c=function(e,a,c,s){if(c.comment&&!(c.comment.length<=0)){var o=c.comment.replace(/\n/g,"
                    "),n={type:a,content:o,token:i.token()};c.disabled=!0,t({method:"POST",url:apiUrl+"new_comment/"+e,data:n}).then(function(t){c.disabled=!1,"function"==typeof s&&s()},function(t){})}},s=function(e,a){return t({method:"GET",url:apiUrl+a+"/"+e+"?token="+i.token()})},o=function(e){t({method:"POST",url:apiUrl+"praise/"+e.act_id,data:{token:i.token(),type:e.act_type}}).then(function(t){console.log(t.data)},function(t){})},n=function(e){t({method:"POST",url:apiUrl+"praise/"+e.act_id,data:{token:i.token(),type:e.act_type}}).then(function(t){console.log(t.data)},function(t){})},r=function(t){t.scope.formData={comment:""};var i=function(i){s(i,t.type).then(function(i){t.loadCallback(i.data)},function(t){})};i(t.id),t.scope.addReply=function(e){console.log(e.comment),c(t.id,t.replyType,e,function(){t.scope.formData={comment:""},i(t.id),"function"==typeof t.replyCallback&&t.replyCallback()})},t.scope.addPraise=function(t){activities=a.get("activities")||[],course_activities=a.get("course_activities")||[],project_activities=a.get("project_activities")||[];for(var i in activities)if(activities[i].act_id==t.act_id){activities[i].praise_count+=1,activities[i].has_praise=!0;break}for(var i in course_activities)if(course_activities[i].act_id==t.act_id){course_activities[i].praise_count+=1,course_activities[i].has_praise=!0;break}for(var i in project_activities)if(project_activities[i].act_id==t.act_id){project_activities[i].praise_count+=1,project_activities[i].has_praise=!0;break}a.save("activities",activities),a.save("course_activities",course_activities),a.save("project_activities",project_activities),t.praise_count+=1,t.has_praise=!0,o(t)},t.scope.decreasePraise=function(t){activities=a.get("activities")||[],course_activities=a.get("course_activities")||[],project_activities=a.get("project_activities")||[];for(var i in activities)if(activities[i].act_id==t.act_id){activities[i].praise_count-=1,activities[i].has_praise=!1;break}for(var i in course_activities)if(course_activities[i].act_id==t.act_id){course_activities[i].praise_count-=1,course_activities[i].has_praise=!1;break}for(var i in project_activities)if(project_activities[i].act_id==t.act_id){project_activities[i].praise_count-=1,project_activities[i].has_praise=!1;break}a.save("activities",activities),a.save("course_activities",course_activities),a.save("project_activities",project_activities),t.praise_count-=1,t.has_praise=!1,n(t)}};return{init:r,addCommonReply:c,loadCommonData:s,addCommonPraise:o,decreaseCommonPraise:n}}]); app.filter("safeHtml",["$sce",function(t){return function(n){return t.trustAsHtml(n)}}]),app.filter("identify",function(){return function(t){return"TeachingAsistant"==t?"教辅":""}}); -app.controller("ActivityController",["$anchorScroll","$location","$scope","$http","$timeout","auth","rms","common","alertService",function(e,a,t,c,o,i,r,s,n){t.replaceUrl=function(e){return e},t.menus=["所有动态","课程动态","项目动态"],t.alertService=n.create(),console.log("ActivityController load"),t.page=r.get("page")||0,t.activities=r.get("activities")||[],t.has_more=r.get("has_more"),t.course_page=r.get("course_page")||0,t.course_activities=r.get("course_activities")||[],t.course_has_more=r.get("course_has_more"),t.project_page=r.get("project_page")||0,t.project_activities=r.get("project_activities")||[],t.project_has_more=r.get("project_has_more"),t.loadActData=function(e,a){switch(container_type="All",e){case 1:container_type="All",t.page=a;break;case 2:container_type="Course",t.course_page=a;break;case 3:container_type="Project",t.project_page=a}c({method:"POST",url:apiUrl+"activities",data:{token:i.token(),page:a,container_type:container_type}}).then(function(e){if(e.data.page>0)switch(e.data.container_type){case"All":t.activities=t.activities.concat(e.data.data);break;case"Course":t.course_activities=t.course_activities.concat(e.data.data);break;case"Project":t.project_activities=t.project_activities.concat(e.data.data);break;case 3:}else switch(e.data.container_type){case"All":t.activities=e.data.data;break;case"Course":t.course_activities=e.data.data;break;case"Project":t.project_activities=e.data.data;break;case 3:}switch(e.data.container_type){case"All":r.save("activities",t.activities),t.has_more=e.data.count+10*e.data.page0)switch(a.data.container_type){case"All":t.activities=t.activities.concat(a.data.data);break;case"Course":t.course_activities=t.course_activities.concat(a.data.data);break;case"Project":t.project_activities=t.project_activities.concat(a.data.data);break;case 3:}else switch(a.data.container_type){case"All":t.activities=a.data.data;break;case"Course":t.course_activities=a.data.data;break;case"Project":t.project_activities=a.data.data;break;case 3:}switch(a.data.container_type){case"All":o.save("activities",t.activities),t.has_more=a.data.count+10*a.data.page
    + 序号 + 班级 @@ -42,6 +42,9 @@ <%=l(:field_is_public)%> + 状态 + <%=l(:field_created_on)%> <%= course.id %> + <%= course.name%> @@ -77,6 +80,9 @@ <%= checked_image course.is_public? %> + <%= course.is_delete == 0 ? '正常' : '归档' %> + <%= format_date(course.created_at) %>