Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop

This commit is contained in:
caishi 2017-09-30 19:42:39 +08:00
commit 1cdecbb312
11 changed files with 34 additions and 15 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -32,7 +32,7 @@
<%= link_to '实训作业'.html_safe, shixuns_homework_common_index_path(:course => @course.id),:class => "color-grey", :remote => true %>
</li>
<li style="text-align:center;">
<a class="color-grey" href="javascript:void(0)">试&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;卷</a>
<%= link_to '试&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;卷'.html_safe, new_exercise_path(:course_id => @course.id),:class => "color-grey" %>
</li>
<li style="text-align:center;">
<a class="color-grey" onclick="course_files_upload();" style="cursor: pointer">资&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;源</a>

View File

@ -41,7 +41,7 @@
<td><%= link_to user.show_real_name, user_path(user), :class => 'edu-txt-w140 task-hide mt5 alink-name', :target => '_blank' %></td>
<td><span class="edu-txt-w140 task-hide mt5"><%= user.user_extensions ? user.user_extensions.student_id : '' %></span></td>
<td><%= member.course_group_id == 0 ? '未分班' : member.course_group.name %></td>
<td><%#= student_course_resource_num @course, user %></td><!--作业成绩-->
<td><%= student_course_homework_score @course, user %></td><!--作业成绩-->
<td><%= student_course_resource_num @course, user %></td>
<td><%= student_course_message_num @course, user %></td>
<td><%= student_course_reply_num @course, user %></td>

View File

@ -59,7 +59,7 @@
<span class="fr mr15 mt3 color-grey"><%= format_time @exercise_user.start_at %> 开始答题</span>
</div>
<% unless @exercise.try(:exercise_description).nil? %>
<% if !@exercise.try(:exercise_description).nil? && @exercise.try(:exercise_description) != "" %>
<div class="edu-con-top font-14 color-grey clearfix user_bg_shadow bor-grey-e mb20">
<pre class="exercise_que_title pl15 pr15"><%= @exercise.try(:exercise_description).html_safe%></pre>
</div>
@ -76,6 +76,8 @@
</div>
<% if @exercise.question_random == 1 %>
<% question_list = @exercise.exercise_questions.shuffle %>
<% else %>
<% question_list = @exercise.exercise_questions %>
<% end %>
<div class="clearfix ml15 mt10 mb15">

View File

@ -26,7 +26,7 @@
<%= link_to "返回", student_exercise_list_exercise_path(@exercise), :class => "fr font-12 mr15 mt3 color-grey" %>
</div>
<% unless @exercise.try(:exercise_description).nil? %>
<% if !@exercise.try(:exercise_description).nil? && @exercise.try(:exercise_description) != "" %>
<div class="edu-con-top font-14 color-grey clearfix user_bg_shadow bor-grey-e mb20">
<pre class="exercise_que_title pl15 pr15"><%= @exercise.try(:exercise_description).html_safe%></pre>
</div>
@ -179,6 +179,7 @@
var spn_class = dataObj.score == 0 ? 'color-red' : 'color-light-green'
$("#multi_q_score_"+id).html("<span class='" + spn_class + " mr3'>"+dataObj.score+ "</span>分");
$("#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();

View File

@ -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);
}
</script>

View File

@ -101,7 +101,9 @@
<li><a href="<%=set_invite_code_halt_course_path(@course) %>" data-remote="true">恢复邀请码</a></li>
<% end %>
<li><%= link_to "设置", {:controller => 'courses', :action => 'settings', :id => @course} %></li>
<li><a href="javascript:void(0);" onclick="delete_confirm_box_3('<%= course_path(@course) %>', '课堂删除后数据将无法恢复,是否确定删除?')">删除</a></li>
<% if User.current == @course.teacher || User.current.admin? %>
<li><a href="javascript:void(0);" onclick="delete_confirm_box_3('<%= course_path(@course) %>', '课堂删除后数据将无法恢复,是否确定删除?')">删除</a></li>
<% end %>
</ul>
</div>

View File

@ -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? %>
</li>
<% count = User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count %>
<li class="clearfix" id="sy_08">
<li class="clearfix" id="sy_04">
<a href="<%= exercise_index_path(:course_id => @course.id) %>" class="fl ml15 ">试卷</a>
<span class="edu-cir-grey fl ml10 mt15"><%= count %></span>
<%#= link_to( "+", new_exercise_path(:course_id => @course.id), :class => 'fr mr15 font-18 link-color-grey', :title =>"新建试卷") if is_teacher %>

View File

@ -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();
}
}