diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 398b385a4..a891d3354 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -344,7 +344,7 @@ class HomeworkCommonController < ApplicationController #当前用户是不是课程的成员 def member_of_course - render_403 unless @course.is_public || User.current.member_of_course?(@course) || User.current.admin? + render_403 unless @course.is_public==1 || User.current.member_of_course?(@course) || User.current.admin? end def get_assigned_homeworks(student_works, n, index) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3a0808bdd..9f516ae1a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -51,7 +51,7 @@ module ApplicationHelper def link_to_user_version(version, options = {}) return '' unless version && version.is_a?(Version) - link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => " f16 fb c_dblue " + link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => "linkBlue" end # 判断课程是否为精品课程 diff --git a/app/models/member.rb b/app/models/member.rb index ed7ee81e6..413fedc07 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -150,7 +150,7 @@ class Member < ActiveRecord::Base #当前学生在指定作业内的得分 def homework_common_score homework_common - StudentWork.select("final_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id) + StudentWork.select("IF(final_score is null,null,final_score - absence_penalty - late_penalty) as final_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id) end def student_work_score_avg @@ -158,7 +158,12 @@ class Member < ActiveRecord::Base end def student_work_score_sum - StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").sum(:final_score).try(:round, 2).to_f + sql_select = "SELECT (SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))) as score + FROM student_works,homework_commons + WHERE student_works.homework_common_id = homework_commons.id + AND homework_commons.course_id = #{self.course_id} + AND student_works.user_id = #{self.user_id}" + score = StudentWork.find_by_sql(sql_select) end protected diff --git a/app/views/courses/_show_member_score.html.erb b/app/views/courses/_show_member_score.html.erb index 2d08e853e..612f408d7 100644 --- a/app/views/courses/_show_member_score.html.erb +++ b/app/views/courses/_show_member_score.html.erb @@ -28,7 +28,7 @@ <% end %> -
  • 作业积分(总分)<%= @member_score.student_work_score_sum %>
  • +
  • 作业积分(总分)<%= (@member_score.student_work_score_sum).first.score %>
  • diff --git a/app/views/homework_common/_homework_search_form.html.erb b/app/views/homework_common/_homework_search_form.html.erb index aa3eef59e..f71cec9a5 100644 --- a/app/views/homework_common/_homework_search_form.html.erb +++ b/app/views/homework_common/_homework_search_form.html.erb @@ -1,6 +1,6 @@ <%= form_tag( url_for(:controller => 'courses',:action => 'homework_search',:id=>course.id), :remote=>true ,:method => 'get',:class=>'resourcesSearchloadBox',:id=>'resource_search_form') do %> - + <%= submit_tag '',:class=>'homepageSearchIcon',:onfocus=>'this.blur();',:style=>'border-style:none' %> <% end %> \ No newline at end of file diff --git a/app/views/users/_homework_type_notice.html.erb b/app/views/users/_homework_type_notice.html.erb new file mode 100644 index 000000000..4dda65e49 --- /dev/null +++ b/app/views/users/_homework_type_notice.html.erb @@ -0,0 +1,13 @@ + +
    +

    +

    +
    + + 继  续 + + + 取  消 + +
    +
    \ No newline at end of file diff --git a/app/views/users/_user_group_attr.html.erb b/app/views/users/_user_group_attr.html.erb index a815d85e7..48c303a29 100644 --- a/app/views/users/_user_group_attr.html.erb +++ b/app/views/users/_user_group_attr.html.erb @@ -16,7 +16,7 @@

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

    - 确定 + 确定
    取消 diff --git a/app/views/users/_user_homework_attachment.html.erb b/app/views/users/_user_homework_attachment.html.erb index 5f4cb4a8e..673cee0e1 100644 --- a/app/views/users/_user_homework_attachment.html.erb +++ b/app/views/users/_user_homework_attachment.html.erb @@ -72,11 +72,15 @@ 上传附件 <%= link_to "资源库",{:controller => 'users',:action=>'user_import_resource',:id=>User.current.id,:homework_id=>container.id},:class => "FilesBtn fl mt3 mr15",:title=>"请从资源库中选择文件作为作品的附件",:remote => true%> <% if defined?(has_program) && has_program %> - 编程 - +
    + 编程 + +
    <% end %> <% if defined?(has_group) && has_group %> - 分组 +
    + 分组 +
    <% end %>
    diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 4082854da..cc7e4bb8e 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -9,9 +9,11 @@ } else { $("#anonymous_comment").attr('checked',false); } - $("#BluePopupBox a.BlueCirBtn").click(); + <% if edit_mode && homework.is_program_homework? %> + $("#BluePopupBox a.BlueCirBtn").click(); + <% end %> <% if edit_mode && homework.is_group_homework? %> - $("#GroupPopupBox a.group_btn").click(); + $("#GroupPopupBox a.group_save_btn").click(); <% end %> }); function checked_val() { @@ -141,4 +143,10 @@ \ No newline at end of file + + +<% unless edit_mode %> + +<% end %> \ No newline at end of file diff --git a/app/views/users/_user_journalsformessage.html.erb b/app/views/users/_user_journalsformessage.html.erb index d7247621a..b377f445c 100644 --- a/app/views/users/_user_journalsformessage.html.erb +++ b/app/views/users/_user_journalsformessage.html.erb @@ -42,7 +42,7 @@ <% if activity.user == User.current || User.current.admin?%>