用户反馈(微信群)-评分作品被修改的提醒

This commit is contained in:
cxt 2017-03-08 09:54:15 +08:00
parent b8856f845a
commit 7de40ac88b
11 changed files with 168 additions and 52 deletions

View File

@ -954,6 +954,9 @@ class StudentWorkController < ApplicationController
render_attachment_warning_if_needed(@new_score)
if @new_score.save
if @work.re_commit && @new_score.reviewer_role != 3
@work.re_commit = 0
end
if @homework.homework_type == 3
@is_group_leader = !@work.student_work_projects.empty?
end
@ -1351,6 +1354,7 @@ class StudentWorkController < ApplicationController
student_work = StudentWork.find attachment.container_id
CourseMessage.create(:user_id => student_work.homework_common.user_id, :course_id => student_work.homework_common.course_id, :viewed => false,:course_message_id=>attachment.container_id,:course_message_type=>'StudentWork',:status=>2)
end
@work.update_attributes(:re_commit => 1)
respond_to do |format|
format.js
end

View File

@ -2566,7 +2566,8 @@ module ApplicationHelper
#如果学生作品被打分后修改,应该给老师提示
def send_message_to_teacher student_work
if StudentWork === student_work
if student_work.student_works_scores.any?
if student_work.student_works_scores.where("reviewer_role != 3").any?
student_work.update_column('re_commit', 1)
course = student_work.homework_common.course
course.members.map(&:user_id).uniq.each do|user_id|
if User.find(user_id).allowed_to?(:as_teacher, course)

View File

@ -56,15 +56,19 @@ module StudentWorkHelper
result
end
def get_status status
def get_status status, re_commit
str = ""
case status
when 0
str = "未提交"
when 1
str = "已提交"
when 2
str = "迟交"
if re_commit
str = "重新提交"
else
case status
when 0
str = "未提交"
when 1
str = "已提交"
when 2
str = "迟交"
end
end
str
end

View File

@ -1,6 +1,6 @@
#学生提交作品表 #work_status :0 未提交 1 已提交 2 迟交 3 分组作品复制的组员作品
class StudentWork < ActiveRecord::Base
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :system_score, :work_score, :project_id, :is_test, :simi_id, :simi_value, :work_status, :commit_time, :late_penalty, :absence_penalty
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :system_score, :work_score, :project_id, :is_test, :simi_id, :simi_value, :work_status, :commit_time, :late_penalty, :absence_penalty, :re_commit
belongs_to :homework_common
belongs_to :user

View File

@ -4,7 +4,7 @@
<span class="hidden fl" style="max-width:220px;"><%= student_work.name %></span>
<span class="fontGrey2 ml5 fl">
<% if student_work.work_status %>
<%= get_status student_work.work_status %>
<%= get_status student_work.work_status, student_work.re_commit %>
<% end %>
</span>
</span>

View File

@ -4,7 +4,7 @@
<span class="hidden fl" style="max-width:220px;"><%= student_work.name %></span>
<span class="fontGrey2 ml5 fl">
<% if student_work.work_status %>
<%= get_status student_work.work_status %>
<%= get_status student_work.work_status, student_work.re_commit %>
<% end %>
</span>
</span>

View File

@ -5,7 +5,7 @@
<span class="hidden fl" style="max-width:220px;"><%= student_work.name %></span>
<span class="fontGrey2 ml5 fl">
<% if student_work.work_status %>
<%= get_status student_work.work_status %>
<%= get_status student_work.work_status, student_work.re_commit %>
<% end %>
</span>
</span>

View File

@ -48,7 +48,7 @@
<% end %>
<td class="<%= @homework.homework_type ==2 ? 'hworkList110' : 'hworkList130' %> c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<% if student_work.work_status%>
<%=get_status student_work.work_status %>
<%= get_status student_work.work_status, student_work.re_commit %>
<% end %>
</td>
<td class="hworkList70 <%= score_color (!score_open || student_work.teacher_score.nil? ? nil : student_work.teacher_score)%>">

View File

@ -72,7 +72,7 @@
<% end%>
<td class="hworkList130 pl10 c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<% if student_work.work_status%>
<%=get_status student_work.work_status %>
<%= get_status student_work.work_status, student_work.re_commit %>
<% end %>
</td>

View File

@ -0,0 +1,5 @@
class AddReCommitToStudentWorks < ActiveRecord::Migration
def change
add_column :student_works, :re_commit, :boolean, :default => false
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20170210082105) do
ActiveRecord::Schema.define(:version => 20170307082304) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -350,14 +350,16 @@ ActiveRecord::Schema.define(:version => 20170210082105) do
add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids"
create_table "changesets", :force => true do |t|
t.integer "repository_id", :null => false
t.string "revision", :null => false
t.integer "repository_id", :null => false
t.string "revision", :null => false
t.string "committer"
t.datetime "committed_on", :null => false
t.datetime "committed_on", :null => false
t.text "comments"
t.date "commit_date"
t.string "scmid"
t.integer "user_id"
t.integer "project_id"
t.integer "type", :default => 0
end
add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on"
@ -519,6 +521,13 @@ ActiveRecord::Schema.define(:version => 20170210082105) do
add_index "contest_messages", ["contest_id"], :name => "index_contest_messages_on_contest_id"
add_index "contest_messages", ["user_id"], :name => "index_contest_messages_on_user_id"
create_table "contest_notifications", :force => true do |t|
t.text "title"
t.text "content"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "contestant_for_contests", :force => true do |t|
t.integer "student_id"
t.integer "contest_id"
@ -586,6 +595,37 @@ ActiveRecord::Schema.define(:version => 20170210082105) do
add_index "contestant_works", ["user_id"], :name => "index_contestant_works_on_user_id"
add_index "contestant_works", ["work_id"], :name => "index_contestant_works_on_work_id"
create_table "contesting_projects", :force => true do |t|
t.integer "project_id"
t.string "contest_id"
t.integer "user_id"
t.string "description"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "reward"
end
create_table "contesting_softapplications", :force => true do |t|
t.integer "softapplication_id"
t.integer "contest_id"
t.integer "user_id"
t.string "description"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "reward"
end
create_table "contestnotifications", :force => true do |t|
t.integer "contest_id"
t.string "title"
t.string "summary"
t.text "description"
t.integer "author_id"
t.integer "notificationcomments_count"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "contests", :force => true do |t|
t.integer "user_id"
t.string "name"
@ -628,20 +668,6 @@ ActiveRecord::Schema.define(:version => 20170210082105) do
t.integer "container_id", :default => 0
end
create_table "course_class_post", :id => false, :force => true do |t|
t.integer "班级id", :default => 0, :null => false
t.string "班级名"
t.integer "帖子id", :default => 0, :null => false
t.integer "主贴id"
t.string "帖子标题", :default => "", :null => false
t.text "帖子内容"
t.integer "帖子用户id"
t.integer "帖子回复数", :default => 0, :null => false
t.integer "最后回帖id"
t.datetime "发帖时间", :null => false
t.datetime "帖子更新时间", :null => false
end
create_table "course_contributor_scores", :force => true do |t|
t.integer "course_id"
t.integer "user_id"
@ -832,6 +858,21 @@ ActiveRecord::Schema.define(:version => 20170210082105) do
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
create_table "delayed_jobs_20161218", :id => false, :force => true do |t|
t.integer "id", :default => 0, :null => false
t.integer "priority", :default => 0, :null => false
t.integer "attempts", :default => 0, :null => false
t.text "handler", :null => false
t.text "last_error"
t.datetime "run_at"
t.datetime "locked_at"
t.datetime "failed_at"
t.string "locked_by"
t.string "queue"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "discuss_demos", :force => true do |t|
t.string "title"
t.text "body"
@ -944,11 +985,13 @@ ActiveRecord::Schema.define(:version => 20170210082105) do
t.integer "exercise_id"
t.integer "score"
t.datetime "start_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "end_at"
t.integer "status"
t.integer "commit_status", :default => 0
t.integer "commit_status", :default => 0
t.integer "objective_score", :default => -1
t.integer "subjective_score", :default => -1
end
create_table "exercises", :force => true do |t|
@ -1064,17 +1107,44 @@ ActiveRecord::Schema.define(:version => 20170210082105) do
add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id"
create_table "homework_bank_tests", :force => true do |t|
t.text "input"
t.text "output"
t.boolean "test_type"
t.integer "homework_bank_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "homework_banks", :force => true do |t|
t.integer "user_id"
t.string "name"
t.text "description"
t.integer "homework_type"
t.integer "quotes", :default => 0
t.boolean "is_public"
t.string "language"
t.text "standard_code", :limit => 2147483647
t.integer "min_num"
t.integer "max_num"
t.boolean "base_on_project"
t.string "applicable_syllabus"
t.integer "homework_common_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "homework_commons", :force => true do |t|
t.string "name"
t.integer "user_id"
t.text "description"
t.date "publish_time"
t.date "end_time"
t.datetime "publish_time"
t.datetime "end_time"
t.integer "homework_type", :default => 1
t.string "late_penalty"
t.integer "course_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "teacher_priority", :default => 1
t.integer "anonymous_comment", :default => 0
t.integer "quotes", :default => 0
@ -1082,6 +1152,8 @@ ActiveRecord::Schema.define(:version => 20170210082105) do
t.datetime "simi_time"
t.integer "score_open", :default => 1
t.integer "anonymous_appeal", :default => 0
t.integer "homework_bank_id"
t.boolean "is_update", :default => false
end
add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id"
@ -1137,6 +1209,16 @@ ActiveRecord::Schema.define(:version => 20170210082105) do
add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id"
add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id"
create_table "homework_samples", :force => true do |t|
t.text "input"
t.text "output"
t.integer "homework_common_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "homework_samples", ["homework_common_id"], :name => "index_homework_samples_on_homework_common_id"
create_table "homework_tests", :force => true do |t|
t.text "input"
t.text "output"
@ -1154,6 +1236,10 @@ ActiveRecord::Schema.define(:version => 20170210082105) do
t.datetime "updated_at", :null => false
end
create_table "innodb_monitor", :id => false, :force => true do |t|
t.integer "a"
end
create_table "invite_lists", :force => true do |t|
t.integer "project_id"
t.integer "user_id"
@ -1735,35 +1821,37 @@ ActiveRecord::Schema.define(:version => 20170210082105) do
end
create_table "projects", :force => true do |t|
t.string "name", :default => "", :null => false
t.string "name", :default => "", :null => false
t.text "description"
t.string "homepage", :default => ""
t.boolean "is_public", :default => true, :null => false
t.string "homepage", :default => ""
t.boolean "is_public", :default => true, :null => false
t.integer "parent_id"
t.datetime "created_on"
t.datetime "updated_on"
t.string "identifier"
t.integer "status", :default => 1, :null => false
t.integer "status", :default => 1, :null => false
t.integer "lft"
t.integer "rgt"
t.boolean "inherit_members", :default => false, :null => false
t.boolean "inherit_members", :default => false, :null => false
t.integer "project_type"
t.boolean "hidden_repo", :default => false, :null => false
t.integer "attachmenttype", :default => 1
t.boolean "hidden_repo", :default => false, :null => false
t.integer "attachmenttype", :default => 1
t.integer "user_id"
t.integer "dts_test", :default => 0
t.integer "dts_test", :default => 0
t.string "enterprise_name"
t.integer "organization_id"
t.integer "project_new_type"
t.integer "gpid"
t.integer "forked_from_project_id"
t.integer "forked_count"
t.integer "publish_resource", :default => 0
t.integer "visits", :default => 0
t.integer "hot", :default => 0
t.integer "publish_resource", :default => 0
t.integer "visits", :default => 0
t.integer "hot", :default => 0
t.string "invite_code"
t.string "qrcode"
t.integer "qrcode_expiretime", :default => 0
t.integer "qrcode_expiretime", :default => 0
t.text "script"
t.integer "training_status", :limit => 1, :default => 0
end
add_index "projects", ["lft"], :name => "index_projects_on_lft"
@ -2064,6 +2152,7 @@ ActiveRecord::Schema.define(:version => 20170210082105) do
t.datetime "commit_time"
t.integer "is_delete", :default => 0
t.integer "appeal_penalty", :default => 0
t.boolean "re_commit", :default => false
end
add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id"
@ -2249,6 +2338,19 @@ ActiveRecord::Schema.define(:version => 20170210082105) do
t.integer "fields_bits", :default => 0
end
create_table "training_tasks", :force => true do |t|
t.integer "project_id"
t.integer "tracker_id"
t.string "subject"
t.text "description"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "author_id"
t.integer "status", :limit => 1, :default => 0
t.integer "position", :limit => 1, :default => 0
t.integer "result", :default => 0
end
create_table "user_actions", :force => true do |t|
t.integer "user_id"
t.string "action_type"