注意:只需要填写课程的全称即可
+正确示例:数据结构
+错误示例:数据结构2017本部
+错误示例:数据结构2017秋季
+错误示例:数据结构2017电子商务1班
+diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 6d68ff08c..1b6d944cd 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -525,6 +525,7 @@ class ExerciseController < ApplicationController @exercise_users_list = search_exercise_member @exercise_users_list, @name + @tab = params[:tab].nil? ? 1 : params[:tab].to_i @score = @b_sort == "desc" ? "asc" : "desc" @exercise_count = @exercise_users_list.count @has_commit_count = @exercise.exercise_users.where(:commit_status => 1).count diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 6b962e35d..117217c1a 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -553,6 +553,51 @@ end end + # 修改单位名称 + def upload_logo + @menu_type = 6 + @sub_type = 1 + @school = School.find(params[:school]) + apply_schools = ApplyAddSchools.where("status = 0") + apply_school_ids = apply_schools.empty? ? "(-1)" : "(" + apply_schools.map{|sc| sc.school_id}.join(',') + ")" + if !params[:search].nil? + search = "%#{params[:search].to_s.strip.downcase}%" + @schools = School.where("id not in #{apply_school_ids} and #{School.table_name}.name like :p", :p => search) + else + @schools = School.where("id not in #{apply_school_ids}") + end + end + + # 修改单位名称为其他 + def school_upload_logo + school = School.where(:id => params[:applied_id]).first + UserExtensions.where(:school_id => params[:applied_id]).update_all(:school_id => params[:school_id]) + Department.where(:school_id => params[:applied_id]).update_all(:school_id => params[:school_id]) + ApplyAddSchools.where(:school_id => params[:applied_id]).destroy_all + ApplyAddDepartment.where(:school_id => params[:applied_id]).destroy_all + school.destroy + redirect_to departments_part_managements_path + end + + # 修改单位信息 + def school_message_update + school = School.where(:name =>params[:schoolname]).first + school_id = school.id + School.where(:id => school_id).update_all(:province => params[:province],:city =>params[:city],:address => params[:address]) + ApplyAddSchools.where(:school_id => school_id).update_all(:province => params[:province],:city =>params[:city],:address => params[:address]) + redirect_to departments_part_managements_path + end + + # 删除单位 + def delete_school + school = School.where(:id => params[:school]).first + UserExtensions.where(:school_id => params[:school]).update_all(:school_id => nil, :department_id => nil) + ApplyAddSchools.where(:school_id => params[:school]).destroy_all + ApplyAddDepartment.where(:school_id => params[:school]).destroy_all + school.destroy + redirect_to departments_part_managements_path + end + def save_school uploaded_io = params[:logo] sl = School.create(:name => params[:schoolname],:province => params[:province],:city => params[:city],:address => params[:address]) @@ -763,13 +808,12 @@ end if !params[:search].nil? search = "%#{params[:search].to_s.strip.downcase}%" @schools = School.where("id not in #{apply_school_ids} and #{School.table_name}.name like :p", :p => search) - #@schools = School.all else - #@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)} @schools = School.where("id not in #{apply_school_ids}") end @edit_id = params[:school_id] @search = params[:search] + @upload = params[:upload] respond_to do |format| format.js end @@ -888,7 +932,9 @@ end @courses = @courses.joins("join users u on courses.tea_id = u.id").where("concat(u.lastname, u.firstname) like '%#{@search}%'") end else - @courses= @courses.where("name like '%#{@search}%'") + school = School.where("name like '%#{@search}%'").map(&:id) + @courses = @courses.where(:school_id => school) + # @courses= @courses.where("name like '%#{@search}%'") end @courses = @courses.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").reorder("updatetime #{@sx_order}") @export_courses = @courses @@ -1018,7 +1064,7 @@ end # 0 全部;1 活动的; 2 已注册; 3 锁定 def users - @menu_type + @menu_type = 7 @sub_type = 1 status = params[:user_status].nil? ? 0 : params[:user_status].to_i @us_order = params[:us_order].blank? ? "desc" : params[:us_order] # 排序 diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index bb25f1404..14deb6c65 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -725,6 +725,16 @@ class ShixunsController < ApplicationController end end + def fork_list + @shixuns = Shixun.where(:fork_from => @shixun.id) + @shixuns_count = @shixuns.count + @limit = 16 + @is_remote = true + @shixun_pages = Paginator.new @shixuns_count, @limit, params['page'] || 1 + @offset ||= @shixun_pages.offset + @shixuns = paginateHelper @shixuns, @limit + end + def show respond_to do |format| format.html{redirect_to shixun_challenges_path(@shixun)} diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 311530b80..b5b272889 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -4845,7 +4845,7 @@ def get_hw_index(hw,is_teacher,type=0) end end hw_ids = homeworks.map{|hw| hw.id} if !homeworks.blank? - index = hw_ids.index(hw.id) + index = hw_ids.length - 1 - hw_ids.index(hw.id) return index end diff --git a/app/models/memo.rb b/app/models/memo.rb index 1eb8f29aa..dc12fe367 100644 --- a/app/models/memo.rb +++ b/app/models/memo.rb @@ -11,7 +11,7 @@ class Memo < ActiveRecord::Base # 若是主题帖,则内容可以是空 #validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? } validates_length_of :subject, maximum: 50 - validates_length_of :content, maximum: 30000 + validate :cannot_reply_to_locked_topic, :on => :create diff --git a/app/views/attachments/_activity_attach.html.erb b/app/views/attachments/_activity_attach.html.erb index fd6eb661f..162eb239b 100644 --- a/app/views/attachments/_activity_attach.html.erb +++ b/app/views/attachments/_activity_attach.html.erb @@ -1,15 +1,15 @@ <% if activity.attachments.any? %> <% activity.attachments.each do |attachment| %>
发布设置
+ <% if @is_teacher %> + 编辑 + <% end %> +发布之前,学生不会收到试卷
+答题设置
+公开设置
+发布设置
+发布之前,学生不会收到试卷
+答题设置
+公开设置
+第<%= i + 1 %>题:[<%= exercise_question.question_type_name %>]<%= exercise_question.question_score %>分
+第<%= i + 1 %>题:[<%= exercise_question.question_type_name %>]<%= exercise_question.question_score %>分
<%= exercise_question.question_title %>+
第<%= exercise_question.question_number %>题:[<%= exercise_question.question_type_name %>]<%= exercise_question.question_score %>分<%= question_commit_status exercise_question, @exercise_user.user %>
+第<%= exercise_question.question_number %>题:[<%= exercise_question.question_type_name %>]<%= exercise_question.question_score %>分<%= question_commit_status exercise_question, @exercise_user.user %>
<% if exercise_question.question_type != 4 %> <% is_correct = answer_is_correct(exercise_question, user) %><%= is_correct ? exercise_question.question_score : 0 %>分
@@ -75,7 +75,7 @@mr3"><%= answer.empty? ? 0 : (answer.first.score == -1 ? "未批" : answer.first.score) %><%= answer.empty? ? "分" : (answer.first.score == -1 ? "" : "分") %>
<% end %><%= exercise_question.question_title %>+
- <%= @user.show_name %> > 论坛 + <%= @user.show_name %> > 讨论区
- <%= memo.viewed_count %> - <%= get_praise_num(memo) %> - <%= Memo.where(:root_id => memo.id).count %> - + <% if memo.viewed_count > 0%> + <%= memo.viewed_count %> + <% end %> + <% if get_praise_num(memo) > 0%> + <%= get_praise_num(memo) %> + <% end %> + <% if Memo.where(:root_id => memo.id).count > 0%> + <%= Memo.where(:root_id => memo.id).count %> + <% end %> +
| ID | -实训名称 | +实训名称 | 顶 | 踩 | -已通关 | -已开启 | +已通关 | +已开启 | +fork数 | 创建者 | 发布时间 color-light-green ml5" title="功能完善中,敬请期待"> | 操作 | @@ -25,6 +26,7 @@<%= Myshixun.where(:shixun_id => shixun.id, :status => 1).count %> | <%= Myshixun.where(:shixun_id => shixun.id).count %> | +<%= Shixun.where(:fork_from =>shixun.id).count %> | <%= shixun.owner.try(:show_real_name) %> | <%= format_time shixun.created_at %> | @@ -36,7 +38,7 @@ | class="ml-3 mr5 magic-checkbox" id="join_course_role_<%= shixun.id %>"> - + | <% end %> diff --git a/app/views/managements/_shixun_authorization_list.html.erb b/app/views/managements/_shixun_authorization_list.html.erb index 756e8b4ae..059994224 100644 --- a/app/views/managements/_shixun_authorization_list.html.erb +++ b/app/views/managements/_shixun_authorization_list.html.erb @@ -32,7 +32,6 @@ <% end %> -
|---|
| 序号 | -测试集输入 | -测试集输出 | -
|---|
| <%=i+1 %> | -
- <%=test.input.blank? ? " " : test.input %> |
-
- <%=test.output.blank? ? " " : test.output %> |
+ 序号 | +测试集输入 | +测试集输出 |
|---|
<%=test.input.blank? ? " " : test.input %>
<%=test.output.blank? ? " " : test.output %>
+ <% if is_teacher || comment.creator_user == User.current%> + 删除 + <% end %> + | + <%= link_to( + '回复'.html_safe, + {:controller => 'users' ,:action => 'reply_to',:reply_id => comment.id, :type => activity.class.to_s, :user_activity_id => activity.id}, + :remote => true, + :method => 'get', + :title => l(:button_reply),:class => "color-grey") %> + | + + <%=render :partial=> "praise_tread/edu_praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + +
+