From 6b49e92424e6f700fc91b1e07d90ac55b8d43203 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 4 Jul 2019 17:23:15 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/competiton_notice_20190704.rake | 35 +++++++++++++++++++++++ lib/trustie/sms/sms.rb | 2 ++ 2 files changed, 37 insertions(+) create mode 100644 lib/tasks/competiton_notice_20190704.rake diff --git a/lib/tasks/competiton_notice_20190704.rake b/lib/tasks/competiton_notice_20190704.rake new file mode 100644 index 00000000..92a273fe --- /dev/null +++ b/lib/tasks/competiton_notice_20190704.rake @@ -0,0 +1,35 @@ +#coding=utf-8 +namespace :competition_notice do + require 'simple_xlsx_reader' + + task :send_message => :environment do + puts "--------------------------------competition_notice send_message start" + attachment = Attachment.where(id: 230670).first + if attachment.present? + path = attachment.disk_directory + name = attachment.disk_filename + if name.split(".").last == "xlsx" + doc = SimpleXlsxReader.open("files/#{path}/#{name}") + sheet = doc.sheets.first + lists = sheet.rows + + lists.each_with_index do |list, index| + if index > 0 + puts "--------------------------------user_name:#{list[0]}, user_phone:#{list[1]}" + user_name = list[0] + user_phone = list[1] + if user_name.present? && user_phone.present? + begin + status = Trustie::Sms.send(mobile: user_phone, send_type:'competition_notice' , name: user_name) + rescue => e + puts "--------------------------------发送验证码出错: #{user_name}---#{user_phone}" + end + end + end + end + else + puts "--------------------------------只支持xlsx文件" + end + end + end +end diff --git a/lib/trustie/sms/sms.rb b/lib/trustie/sms/sms.rb index 7c2dad4c..03b1dbe7 100644 --- a/lib/trustie/sms/sms.rb +++ b/lib/trustie/sms/sms.rb @@ -31,6 +31,8 @@ module Trustie params['text'] = "" if send_type.nil? params['text'] = "【Edu实训】" + code + "(手机验证码)。如非本人操作,请忽略。" + elsif send_type == "competition_notice" + params['text'] = "【Edu实训】亲爱的#{name},你参与的全国绿色计算大赛2019于7月1日开始,请及时完善信息,详戳→http://opengcc.org.cn/" elsif send_type == "teacher_register" params['text'] = "【Edu实训】亲爱的#{user_name},有新的老师#{name}注册啦,请尽快处理" elsif send_type == 'competition_start' From c0c94148545471d7b2dfd9d84b5c525979116880 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 4 Jul 2019 17:24:23 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E9=9A=90=E8=97=8F=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E5=BC=B9=E6=A1=86=E4=B8=AD=E7=9A=84=E5=AE=9E?= =?UTF-8?q?=E8=AE=AD=E5=88=9B=E5=BB=BA=E8=80=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/_shixun_work_show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/student_work/_shixun_work_show.html.erb b/app/views/student_work/_shixun_work_show.html.erb index ee9cd765..77e3062f 100644 --- a/app/views/student_work/_shixun_work_show.html.erb +++ b/app/views/student_work/_shixun_work_show.html.erb @@ -3,8 +3,8 @@
- <%= link_to @shixun.owner.try(:show_real_name), user_path(@shixun.owner), :class => "color-grey3 fl", :target => "_blank" %> - / + <%#= link_to @shixun.owner.try(:show_real_name), user_path(@shixun.owner), :class => "color-grey3 fl", :target => "_blank" %> + <%= link_to @shixun.name, shixun_path(@shixun), :class => "edu-info-dark fl task-hide",:style=>"max-width:300px", :target => "_blank" %>
<% if User.current.has_teacher_role(@homework.course) || User.current.admin? || @work.user == User.current %> From 2bbffda6677efa8dddd70a69e25c7e1119f7c003 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Thu, 4 Jul 2019 17:25:28 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E6=88=98=E9=98=9F=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../competitions/_competition_team_detail.html.erb | 10 ++++++++++ .../_qg_second_course_competition.html.erb | 4 ++-- public/stylesheets/educoder/edu-all.css | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 app/views/competitions/_competition_team_detail.html.erb diff --git a/app/views/competitions/_competition_team_detail.html.erb b/app/views/competitions/_competition_team_detail.html.erb new file mode 100644 index 00000000..88dd992d --- /dev/null +++ b/app/views/competitions/_competition_team_detail.html.erb @@ -0,0 +1,10 @@ ++ 战队详情 + 返回 +
+实训项目
+<%= @competition.name %>
- <% if @minimum_staff > 1 %> + <% if @maximum_staff > 1 %><%= @competition.sub_title %>
<% unless User.current.logged? %> <%= link_to "创建战队", signin_path, :remote => true, :class => "enroll-in-b enroll-in-b-green fr" %> <% else %> <% unless @competition.enroll_end_time.present? && @competition.enroll_end_time < Time.now %> - <% if @is_enroll.present? && !@user.is_teacher %> + <% if !@can_enroll %> 创建战队 <% else %> 创建战队 @@ -23,7 +23,7 @@ <%= link_to "加入战队", signin_path, :remote => true, :class => "enroll-in-b fr" %> <% else %> <% unless @competition.enroll_end_time.present? && @competition.enroll_end_time < Time.now %> - <% if @is_enroll.present? && !@user.is_teacher %> + <% if !@can_enroll %> 加入战队 <% else %> 加入战队 @@ -40,7 +40,7 @@ <% else %>
<% unless @competition.enroll_end_time.present? && @competition.enroll_end_time < Time.now %> - <% if @is_enroll.present? %> + <% if !@can_enroll %> 立即报名 <% else %> <%= link_to "立即报名", personal_enroll_competition_teams_path(:com_id => @competition.id), :remote => true, :class => "enroll-in-b enroll-in-b-green fr" %> @@ -97,6 +97,10 @@ 退出 <% end %> <% end %> + + <% if @competition.identifier == 'gcc-course-2019' %> + <%= link_to '战队详情', competition_team_path(id: @competition.id) %> + <% end %> <% end %>
请选择指导老师,允许修改
<% @teachers.each do |teacher| %> -+
战队详情 返回
-实训项目
-创建者 | +名称 | +学习人数 | +fork版的学习人数 | +有效作品数 | +制作应用经验值 | + + +
---|---|---|---|---|---|
胡莎莎 | ++ 单链表的学习与应用(I) + | +2.5万 | +1456 | +2.5万 | +4545667 | +合计: | +6 | +5.5万 | +7878 | +2.5万 | +245364 | + +
+
战队详情 返回
-实训项目
-创建者 | -名称 | -学习人数 | -fork版的学习人数 | -有效作品数 | -制作应用经验值 | +
---|
创建者 | +名称 | +学习人数 | +fork版的学习人数 | +有效作品数 | +经验值 | +
---|---|---|---|---|---|
胡莎莎 | -- 单链表的学习与应用(I) - | -2.5万 | -1456 | -2.5万 | -4545667 | +
张三 | ++ MySQL数据库编程开发实训(基础入门篇)MySQL数据库编程开发实训(基础入门篇) + 原创 + | +1545 | +1246 | +111 | +54987 | +
合计 | +6 | +12万 | +11 | +22 | +33 |
翻转课堂
+创建者 | +名称 | +学生数量 | +发布的实训作业数量 | +有效作品数 | +经验值 | +
---|---|---|---|---|---|
张三 | ++ MySQL数据库编程开发实训(基础入门篇)MySQL数据库编程开发实训(基础入门篇) + | +1545 | +1246 | +111 | +54987 | +合计: | -6 | -5.5万 | -7878 | -2.5万 | -245364 | + +
合计 | +6 | +12万 | +11 | +22 | +33 | +
+ 战队详情 + <%= link_to '返回', enroll_competition_path(@competition), class: 'color-grey-9 fr' %> +
+实训项目
+创建者 | +名称 | +学习人数 | +fork版的学习人数 | +有效作品数 | +经验值 | +
---|---|---|---|---|---|
<%= shixun.creator.show_real_name %> | ++ <%= link_to shixun_path(shixun), target: '_blank' do %> + <%= shixun.name %> + <% end %> + <% if shixun.fork_from.blank? %> + 原创 + <% end %> + | +<%= shixun.myshixuns_count.to_i.zero? ? '--' : shixun.myshixuns_count.to_i %> | +<%= shixun['forked_myshixun_count'].to_i.zero? ? '--' : shixun['forked_myshixun_count'].to_i %> | +<%= @myshixun_count_map.fetch(shixun.id, '--') %> | +-- | +
合计 | +<%= @shixuns.size %> | +<%= total_myshixun_count %> | +<%= total_forked_myshixun_count %> | +<%= @myshixun_count_map.values.reduce(:+) %> | +-- | +
翻转课堂
+创建者 | +名称 | +学生数量 | +发布的实训作业数量 | +有效作品数 | +经验值 | +
---|---|---|---|---|---|
<%= course.teachers.where(user_id: @team_user_ids).first.user.show_real_name %> | ++ <%= course.name %> + | +<%= course.members_count %> | +<%= course['shixun_homework_count'].presence || '--' %> | +<%= @course_myshixun_map.fetch(course.id, '--') %> | +-- | +
合计 | +<%= @courses.size %> | +<%= total_members_count %> | +<%= total_shixun_homework_count %> | +<%= @course_myshixun_map.values.reduce(:+) %> | +-- | +
- 战队详情 - 返回 -
-实训项目
-创建者 | -名称 | -学习人数 | -fork版的学习人数 | -有效作品数 | -经验值 | -
---|---|---|---|---|---|
张三 | -- MySQL数据库编程开发实训(基础入门篇)MySQL数据库编程开发实训(基础入门篇) - 原创 - | -1545 | -1246 | -111 | -54987 | -
合计 | -6 | -12万 | -11 | -22 | -33 | -
翻转课堂
-创建者 | -名称 | -学生数量 | -发布的实训作业数量 | -有效作品数 | -经验值 | -
---|---|---|---|---|---|
张三 | -- MySQL数据库编程开发实训(基础入门篇)MySQL数据库编程开发实训(基础入门篇) - | -1545 | -1246 | -111 | -54987 | -
合计 | -6 | -12万 | -11 | -22 | -33 | -