diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb
index 6fe639260..6d68ff08c 100644
--- a/app/controllers/exercise_controller.rb
+++ b/app/controllers/exercise_controller.rb
@@ -31,7 +31,7 @@ class ExerciseController < ApplicationController
exercises = exercises.where("exercise_name like '%#{@search}%'")
end
@exercises = paginateHelper exercises,15 #分页
- @left_nav_type = 8
+ @left_nav_type = 4
respond_to do |format|
format.js
format.html
@@ -172,7 +172,7 @@ class ExerciseController < ApplicationController
@exercise = Exercise.find(params[:id])
exercise_questions = @exercise.exercise_questions
@exercise_questions = paginateHelper exercise_questions, 5
- @left_nav_type = 8
+ @left_nav_type = 4
respond_to do |format|
format.html{render :layout => 'base_courses'}
end
diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb
index dee8d5bf5..d8422beaa 100644
--- a/app/controllers/games_controller.rb
+++ b/app/controllers/games_controller.rb
@@ -67,7 +67,10 @@ class GamesController < ApplicationController
shixun_new_commit = g.commits(@myshixun.shixun.try(:gpid)).first.try(:id)
@myshixun.update_column(:commit_id, shixun_new_commit)
sleep(2) # g
- render :json => {:status => 200}
+ respond_to do |format|
+ format.js{ redirect_to myshixun_game_path( @game, :myshixun_id => @myshixun)}
+ end
+ # render :json => {:status => 200}
end
def index
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index 21acbdcb2..1a19f3180 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -12,6 +12,15 @@ module CoursesHelper
#AllPeople = StudentRoles+TeacherRoles
## return people count
+ def student_course_homework_score course, user
+ homework_ids = course.homework_commons.where("homework_type in (1, 4) and publish_time < '#{Time.now}'").map(&:id)
+ score = 0
+ user.student_works.where(:homework_common_id => homework_ids).each do |work|
+ score = score + work.work_score if work.work_score
+ end
+ format("%.1f",score)
+ end
+
# 学生的发布资源数
def student_course_resource_num course, user
num = course.attachments.where(:author_id => user.id).count
diff --git a/app/views/courses/_course_activity_content.html.erb b/app/views/courses/_course_activity_content.html.erb
index 5b7d02b73..87d5c9252 100644
--- a/app/views/courses/_course_activity_content.html.erb
+++ b/app/views/courses/_course_activity_content.html.erb
@@ -32,7 +32,7 @@
<%= link_to '实训作业'.html_safe, shixuns_homework_common_index_path(:course => @course.id),:class => "color-grey", :remote => true %>
- 试 卷
+ <%= link_to '试 卷'.html_safe, new_exercise_path(:course_id => @course.id),:class => "color-grey" %>
资 源
diff --git a/app/views/courses/settings/_student_table.html.erb b/app/views/courses/settings/_student_table.html.erb
index a822f7de7..3248e4616 100644
--- a/app/views/courses/settings/_student_table.html.erb
+++ b/app/views/courses/settings/_student_table.html.erb
@@ -41,7 +41,7 @@
<%= link_to user.show_real_name, user_path(user), :class => 'edu-txt-w140 task-hide mt5 alink-name', :target => '_blank' %> |
<%= user.user_extensions ? user.user_extensions.student_id : '' %> |
<%= member.course_group_id == 0 ? '未分班' : member.course_group.name %> |
- <%#= student_course_resource_num @course, user %> |
+ <%= student_course_homework_score @course, user %> |
<%= student_course_resource_num @course, user %> |
<%= student_course_message_num @course, user %> |
<%= student_course_reply_num @course, user %> |
diff --git a/app/views/exercise/_exercise_student.html.erb b/app/views/exercise/_exercise_student.html.erb
index d06dc69dc..8b9ff2b83 100644
--- a/app/views/exercise/_exercise_student.html.erb
+++ b/app/views/exercise/_exercise_student.html.erb
@@ -59,7 +59,7 @@
<%= format_time @exercise_user.start_at %> 开始答题
- <% unless @exercise.try(:exercise_description).nil? %>
+ <% if !@exercise.try(:exercise_description).nil? && @exercise.try(:exercise_description) != "" %>
<%= @exercise.try(:exercise_description).html_safe%>
@@ -76,6 +76,8 @@
<% if @exercise.question_random == 1 %>
<% question_list = @exercise.exercise_questions.shuffle %>
+ <% else %>
+ <% question_list = @exercise.exercise_questions %>
<% end %>
diff --git a/app/views/exercise/_exercise_student_result.html.erb b/app/views/exercise/_exercise_student_result.html.erb
index cbfa08564..79ade0035 100644
--- a/app/views/exercise/_exercise_student_result.html.erb
+++ b/app/views/exercise/_exercise_student_result.html.erb
@@ -26,7 +26,7 @@
<%= link_to "返回", student_exercise_list_exercise_path(@exercise), :class => "fr font-12 mr15 mt3 color-grey" %>
-<% unless @exercise.try(:exercise_description).nil? %>
+ <% if !@exercise.try(:exercise_description).nil? && @exercise.try(:exercise_description) != "" %>
<%= @exercise.try(:exercise_description).html_safe%>
@@ -179,6 +179,7 @@
var spn_class = dataObj.score == 0 ? 'color-red' : 'color-light-green'
$("#multi_q_score_"+id).html(""+dataObj.score+ "分");
$("#exercise_user_score").html(dataObj.total_score);
+ $("#ex_comment_status_"+id).removeClass("post_btn_grey").addClass("post_btn_white");
$("#ajax_notice_p").html("分数已保存");
$("#ajax-notice").css('top', $(window).scrollTop()+400);
$("#ajax-notice").show();
diff --git a/app/views/games/_game_show.html.erb b/app/views/games/_game_show.html.erb
index 9436b6fc2..5eb64b918 100644
--- a/app/views/games/_game_show.html.erb
+++ b/app/views/games/_game_show.html.erb
@@ -210,17 +210,18 @@
function sync_hide_tip_content(){
$(".tip-panel-animate").addClass("animate-tip-hide");
setTimeout('$(".tip-panel-animate").hide();', 700);
- alert("test");
$.ajax({
url: "<%= sync_codes_myshixun_game_path(@game, :myshixun_id => @myshixun) %>",
dataType: "script",
success: function(data){
- alert(data.status);
- if(data.status == 200){
- $('#ajax-indicator-base').html("").hide();
- $('#'+target).html(data);
- }
+// $('#ajax-indicator-base').html("").hide();
}
})
}
+
+ //隐藏更新提示方法
+ function hide_tip_content(){
+ $(".tip-panel-animate").addClass("animate-tip-hide");
+ setTimeout('$(".tip-panel-animate").hide();', 700);
+ }
\ No newline at end of file
diff --git a/app/views/layouts/_course_base_info.html.erb b/app/views/layouts/_course_base_info.html.erb
index 893fb84cf..18fce614e 100644
--- a/app/views/layouts/_course_base_info.html.erb
+++ b/app/views/layouts/_course_base_info.html.erb
@@ -101,7 +101,9 @@
恢复邀请码
<% end %>
<%= link_to "设置", {:controller => 'courses', :action => 'settings', :id => @course} %>
- 删除
+ <% if User.current == @course.teacher || User.current.admin? %>
+ 删除
+ <% end %>
diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb
index 6d3e385f0..9ed00f231 100644
--- a/app/views/layouts/base_courses.html.erb
+++ b/app/views/layouts/base_courses.html.erb
@@ -117,7 +117,7 @@
<%#= link_to( "+", new_board_message_path(:board_id => course_board.id), :class => 'fr mr15 font-18 link-color-grey', :title => "#{l(:label_message_new)}") if User.current.logged? %>
<% count = User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count %>
-
+
试卷
<%= count %>
<%#= link_to( "+", new_exercise_path(:course_id => @course.id), :class => 'fr mr15 font-18 link-color-grey', :title =>"新建试卷") if is_teacher %>
diff --git a/public/javascripts/edu/homework.js b/public/javascripts/edu/homework.js
index 227c28b99..7d28bd571 100644
--- a/public/javascripts/edu/homework.js
+++ b/public/javascripts/edu/homework.js
@@ -346,5 +346,6 @@ function new_shixun_homework(id){
var type=$("input[name='shixun_homework']:checked").val();
console.log(type);
$("#shixun_homework_common_new").submit();
+ hideModal();
}
}