diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 364742aea..138030a3c 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -268,11 +268,9 @@ class HomeworkAttachController < ApplicationController def show if User.current.admin? || User.current.member_of_course?(@homework.bid.courses.first) # 打分统计 - stars_reates = @homework. - rates(:quality) + stars_reates = @homework. rates(:quality) stars_reates_count = stars_reates.count == 0 ? 1 : stars_reates.count - stars_status = stars_reates.select("stars, count(*) as scount"). - group("stars") + stars_status = stars_reates.select("stars, count(*) as scount").group("stars") @stars_status_map = Hash.new(0.0) stars_status.each do |star_status| percent = (star_status.scount * 1.0/ stars_reates_count) * 100.to_f @@ -294,6 +292,10 @@ class HomeworkAttachController < ApplicationController @totle_score = score_for_homework @homework @teaher_score = teacher_score_for_homework @homework + + respond_to do |format| + format.js + end else render_403 :message => :notice_not_authorized end diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 1afb94220..eeedbd19d 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -394,10 +394,7 @@ module CoursesHelper #获取作业的教师评分 #多个教师只获取一份教师评分 def teacher_score_for_homework homework - members = searchTeacherAndAssistant(homework.bid.courses.first)#searchPeopleByRoles(homework.bid.courses.first,TeacherRoles).first - #if member.nil? - # return "0.00" - #end + members = searchTeacherAndAssistant(homework.bid.courses.first) teacher_ids = [] members.each do |user| teacher_ids << user.user_id @@ -407,7 +404,7 @@ module CoursesHelper teacher_stars.each do |star| teacher_stars_count = teacher_stars_count + star.stars end - return format("%.2f",teacher_stars_count) + return format("%.2f",teacher_stars.count > 0 ? teacher_stars_count/teacher_stars.count : 0) end #获取指定项目的得分 diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index 95b805ba3..960e3acff 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -36,6 +36,7 @@ - + +
diff --git a/app/views/homework_attach/_homeworks_list.html.erb b/app/views/homework_attach/_homeworks_list.html.erb index 28fa1b6aa..c3abba458 100644 --- a/app/views/homework_attach/_homeworks_list.html.erb +++ b/app/views/homework_attach/_homeworks_list.html.erb @@ -33,7 +33,7 @@ <% else %> <% homework_filename = homework.name %> <% end %> - <%= link_to homework_filename , homework_attach_path(homework), :title => homework_filename%> + <%= link_to homework_filename , homework_attach_path(homework), :title => homework_filename, :remote => true%>
  • <%= link_to "(#{homework.attachments.count.to_s}个附件)", zipdown_download_user_homework_path(:homework => homework)%> @@ -52,9 +52,7 @@
  • - - <%= l(:label_work_rating)%> - + <%= link_to l(:label_work_rating),homework_attach_path(homework),:remote => true %> <% if Time.parse(bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>   迟交! <% end %> diff --git a/app/views/homework_attach/_show.html.erb b/app/views/homework_attach/_show.html.erb new file mode 100644 index 000000000..268b5a55e --- /dev/null +++ b/app/views/homework_attach/_show.html.erb @@ -0,0 +1,128 @@ + + + + + 作业评分弹框 + + <%= stylesheet_link_tag 'css', :media => 'all' %> + + + +
    +
    +
    + + +
    +
    +
    +

    科大校园助手最终提交文档及源码

    +
      +
    • 参与人员:gugu02
    • +
    • 发布时间:2014-10-24
    • +
    +
    +

    我写了一个验证身份证号码的程序,它是以一定内存空间(大概100M)换取cpu消耗,然后它的运算量就降低了,前十四位的验证就相当于转换类型再查表一样,所以它的验证号码速度比一般的方式快。如果还不明白就说明你写框架写多了,或者你不了解java基础。测试结果只代表算法效率,测一个号码是因为正确号码运算次数基本相同,如果你们用自己的电脑测,13亿次循环应该不到1分钟。这种设计思路,也可以套式信息验证上去。

    +

    附件:附件1附件2附件3附件4附件5

    + +
    + 评分: + + + + + +
    +
    + + 提交评论 +
    +
    + +
    +
    +
      +
    • + 全部评论(100)
    • +
    • + 教师评论
    • +
    +
    +
    +
    +
    +
    +
    +
    +
    + gugu012014-10-24评分: +
    +

    我写了一个验证身份证号码的程序,它是以一定内存空间(大概100M)换取cpu消耗,然后它的运算量就降低了,前十四位的验证就相当于转换类型再查表一样,所以它的验证号码速度比一般的方式快。如果还不明白就说明你写框架写多了,或者

    +
    + + +
    +
    +
    +
    +
    +
    +
    + gugu012014-10-24评分: +
    +

    我写了一个验证身份证号码的程序,它是以一定内存空间(大概100M)换取cpu消耗,然后它的运算量就降低了,前十四位的验证就相当于转换类型再查表一样,所以它的验证号码速度比一般的方式快。如果还不明白就说明你写框架写多了,或者

    +
    + + + +
    +
    +
    +
    +
    +
    +
    + gugu012014-10-24评分: +
    +

    我写了一个验证身份证号码的程序,它是以一定内存空间(大概100M)换取cpu消耗,然后它的运算量就降低了,前十四位的验证就相当于转换类型再查表一样,所以它的验证号码速度比一般的方式快。如果还不明白就说明你写框架写多了,或者

    +
    + + + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + gugu012014-10-24评分: +
    +

    我写了一个验证身份证号码的程序,它是以一定内存空间(大概100M)换取cpu消耗,然后它的运算量就降低了,多了,或者

    +
    + + + +
    +
    +
    + +
    +
    + + +
    + +
    + + diff --git a/app/views/homework_attach/show.js.erb b/app/views/homework_attach/show.js.erb new file mode 100644 index 000000000..d55c24796 --- /dev/null +++ b/app/views/homework_attach/show.js.erb @@ -0,0 +1,3 @@ +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show') %>'); +showModal('ajax-modal', '510px'); +$('#ajax-modal').css('height','500px'); diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css index 0adccd091..88b0163dc 100644 --- a/public/stylesheets/css.css +++ b/public/stylesheets/css.css @@ -60,7 +60,7 @@ ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; } /****评分弹框****/ -#popbox{width:488px;height:550px;position:absolute;z-index:100;left:50%;top:40%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; padding:5px; overflow:auto; } + .alert .close{width:26px;height:26px;overflow:hidden;position:absolute;top:-10px;right:-502px;background:url(images/close.png) no-repeat;cursor:pointer;} .alert .C{width:476px;height:296px;position:absolute;left:5px;top:5px; }