diff --git a/app/controllers/admins/tag_disciplines_controller.rb b/app/controllers/admins/tag_disciplines_controller.rb index c1bfee0dc..352146bcd 100644 --- a/app/controllers/admins/tag_disciplines_controller.rb +++ b/app/controllers/admins/tag_disciplines_controller.rb @@ -8,7 +8,7 @@ class Admins::TagDisciplinesController < Admins::BaseController def create name = params[:name].to_s.strip return render_error('名称重复') if current_sub_discipline.tag_disciplines.where(name: name).exists? - TagDiscipline.create!(name: name, sub_discipline_id: current_sub_discipline.id) + TagDiscipline.create!(name: name, sub_discipline_id: current_sub_discipline.id, user_id: current_user.id) render_ok end diff --git a/app/models/tag_discipline.rb b/app/models/tag_discipline.rb index e709e35e5..24567505e 100644 --- a/app/models/tag_discipline.rb +++ b/app/models/tag_discipline.rb @@ -1,5 +1,6 @@ class TagDiscipline < ApplicationRecord belongs_to :sub_discipline + belongs_to :user has_many :tag_discipline_containers, dependent: :destroy def discipline diff --git a/app/views/admins/tag_disciplines/shared/_list.html.erb b/app/views/admins/tag_disciplines/shared/_list.html.erb index f6d92d366..2c91d88fa 100644 --- a/app/views/admins/tag_disciplines/shared/_list.html.erb +++ b/app/views/admins/tag_disciplines/shared/_list.html.erb @@ -2,7 +2,8 @@ <thead class="thead-light"> <tr> <th width="6%">序号</th> - <th width="54%" class="text-left">知识点</th> + <th width="42%" class="text-left">知识点</th> + <th width="12%">创建者</th> <th width="8%">实践课程</th> <th width="8%">实训</th> <th width="8%">题库</th> @@ -15,6 +16,13 @@ <tr class="tag-discipline-item tag-discipline-item-<%= tag.id %>"> <td><%= index + 1 %></td> <td class="text-left"><%= tag.name %></td> + <td> + <% if tag.user.present? %> + <%= link_to tag.user.real_name, user_path(tag.user), :target => "_blank" %> + <% else %> + -- + <% end %> + </td> <td> <% disabled = !(tag.sub_discipline&.subject && tag.discipline&.subject) %> <%= check_box_tag :subject,!tag.subject,tag.subject,disabled:disabled,remote:true,data:{id:tag.id},class:"tag-discipline-source-form" %> diff --git a/app/views/homework_commons/works_list.json.jbuilder b/app/views/homework_commons/works_list.json.jbuilder index b8fa73b66..e47430f5f 100644 --- a/app/views/homework_commons/works_list.json.jbuilder +++ b/app/views/homework_commons/works_list.json.jbuilder @@ -16,6 +16,7 @@ json.is_evaluation @is_evaluation ? @is_evaluation : false json.work_public @homework.work_public json.allow_late @homework.allow_late + if @user_course_identity < Course::STUDENT json.calculation_time @homework.calculation_time if @homework.homework_type == "practice" diff --git a/db/migrate/20191231064614_add_user_id_to_tag_discipline.rb b/db/migrate/20191231064614_add_user_id_to_tag_discipline.rb new file mode 100644 index 000000000..4de5b8f0a --- /dev/null +++ b/db/migrate/20191231064614_add_user_id_to_tag_discipline.rb @@ -0,0 +1,5 @@ +class AddUserIdToTagDiscipline < ActiveRecord::Migration[5.2] + def change + add_column :tag_disciplines, :user_id, :integer + end +end