diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 8fa90ea46..25b5dacec 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -16,10 +16,7 @@ class ExerciseController < ApplicationController exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) end end - end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now) - end_exercises.each do |exercise| - exercise.update_column('exercise_status', 3) - end + if @course.is_public == 0 && !(User.current.member_of_course?(@course)||User.current.admin?) render_403 return @@ -46,10 +43,7 @@ class ExerciseController < ApplicationController exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) end end - end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now) - end_exercises.each do |exercise| - exercise.update_column('exercise_status', 3) - end + unless User.current.member_of_course?(@course) || User.current.admin? render_403 return diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 00dfc03e3..4dcdb7749 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -1,20 +1,3 @@ -<%= content_for(:header_tags) do %> - <%= import_ke(enable_at: true, prettify: false) %> - <%= javascript_include_tag "init_activity_KindEditor" %> -<% end %> - - - <% if topic %> - <%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id} %> - <% end %> - <% end %> - - <% if topics.count == 10 %> -
展开更多<%= link_to "", boards_topic_path(@board, :course_id => @board.course.id ,:page => page), :id => "more_topic_link", :remote => "true", :class => "none" %>
- <% end %> -<% end%> - - - + <%= render :partial=> 'course_show_detail',:locals =>{:topics => @topics, :page => 0} %> diff --git a/app/views/boards/_course_show_detail.html.erb b/app/views/boards/_course_show_detail.html.erb new file mode 100644 index 000000000..c324f1d69 --- /dev/null +++ b/app/views/boards/_course_show_detail.html.erb @@ -0,0 +1,70 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false) %> + <%= javascript_include_tag "init_activity_KindEditor" %> +<% end %> + + +<% if topics%> + <% topics.each do |topic| %> + + <% if topic %> + <%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id} %> + <% end %> + <% end %> + + <% if topics.count == 10 %> +
展开更多<%= link_to "", boards_topic_path(@board, :course_id => @board.course.id ,:page => page), :id => "more_topic_link", :remote => "true", :class => "none" %>
+ <% end %> +<% end%> + + \ No newline at end of file diff --git a/app/views/boards/show.js.erb b/app/views/boards/show.js.erb index dd5fa4688..c088abce5 100644 --- a/app/views/boards/show.js.erb +++ b/app/views/boards/show.js.erb @@ -1 +1 @@ -$("#show_more_course_topic").replaceWith("<%= escape_javascript( render :partial => 'boards/course_show',:locals => {:topics => @topics, :page => @page} )%>"); \ No newline at end of file +$("#show_more_course_topic").replaceWith("<%= escape_javascript( render :partial => 'boards/course_show_detail',:locals => {:topics => @topics, :page => @page} )%>"); \ No newline at end of file diff --git a/app/views/exercise/_student_exercise.html.erb b/app/views/exercise/_student_exercise.html.erb index bbbe9026d..3bcd6b83f 100644 --- a/app/views/exercise/_student_exercise.html.erb +++ b/app/views/exercise/_student_exercise.html.erb @@ -75,6 +75,9 @@
  • <% if exercise.created_at%> <%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>  + <% if @exercise.end_time <= exercise.created_at %> + [未答] + <% end %> <% end %>
  • diff --git a/app/views/student_work/_choose_group_member.html.erb b/app/views/student_work/_choose_group_member.html.erb index dc650cfa8..c47c31d9d 100644 --- a/app/views/student_work/_choose_group_member.html.erb +++ b/app/views/student_work/_choose_group_member.html.erb @@ -1,3 +1,4 @@ +<% if @homework.homework_detail_group %>
    请从<%= @homework.homework_detail_group.base_on_project == 1 ? '项目成员':'课程成员' %>中添加小组成员
    @@ -105,4 +106,5 @@ <% end %> <% end %> }); - \ No newline at end of file + +<% end %> \ No newline at end of file diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 60b8e6728..f02105fb6 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -97,11 +97,21 @@
    -
    + +
    + 迟交扣分:<%= activity.late_penalty%>分 +
    +
    匿评开启时间:<%= activity.homework_detail_manual.evaluation_start%> 00:00
    -
    +
    +
    +
    +
    + 缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品 +
    +
    匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%> 23:59
    diff --git a/app/views/users/_user_group_attr.html.erb b/app/views/users/_user_group_attr.html.erb index 652cb723a..a815d85e7 100644 --- a/app/views/users/_user_group_attr.html.erb +++ b/app/views/users/_user_group_attr.html.erb @@ -10,7 +10,7 @@

    提醒:勾选后各小组必须在Trustie平台创建项目,教师可随时观察平台对各小组最新进展的实时统计。

    diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index d9421f5ea..5bfe1814d 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -102,11 +102,21 @@
    -
    + +
    + 迟交扣分:<%= homework_common.late_penalty%>分 +
    +
    匿评开启时间:<%= homework_common.homework_detail_manual.evaluation_start%> 00:00
    -
    +
    +
    +
    +
    + 缺评扣分:<%= homework_common.homework_detail_manual.absence_penalty%>分/作品 +
    +
    匿评关闭时间:<%= homework_common.homework_detail_manual.evaluation_end%> 23:59
    diff --git a/lib/tasks/exercise_publish.rake b/lib/tasks/exercise_publish.rake index a27c6a6fb..13ae8c484 100644 --- a/lib/tasks/exercise_publish.rake +++ b/lib/tasks/exercise_publish.rake @@ -14,9 +14,21 @@ namespace :exercise_publish do end task :end => :environment do + include ExerciseHelper exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now) exercises.each do |exercise| + course = exercise.course exercise.update_column('exercise_status', 3) + course.student.each do |student| + if ExerciseUser.where("user_id = ? && exercise_id = ?",student.student_id,exercise.id).empty? + ExerciseUser.create(:user_id => student.student_id, :exercise_id => exercise.id, :start_at => exercise.end_time, :status => true,:score=>0) + end +=begin + s_score = calculate_student_score(exercise, student.student) + exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", student.student_id, exercise.id).first + exercise_user.update_attributes(:score => s_score) +=end + end end end end