From d22ab9288c486b312c4058fe8edf2951a366bdf4 Mon Sep 17 00:00:00 2001 From: Bohung Date: Sun, 4 Apr 2021 20:33:09 +0800 Subject: [PATCH] Add feature that assign signups to multiple reviewers. --- app/models/seminar_main.rb | 2 +- app/models/seminar_review.rb | 4 +- .../_seminar_signup_dashboard.html.erb | 81 ++++++++++++++++++- .../_seminar_signup_render_table.html.erb | 2 +- ..._seminar_signup_session_dashboard.html.erb | 57 ++++++++++++- .../admin/seminars/seminar_signup.html.erb | 5 +- config/locales/en.yml | 1 + config/locales/zh_tw.yml | 1 + 8 files changed, 142 insertions(+), 11 deletions(-) diff --git a/app/models/seminar_main.rb b/app/models/seminar_main.rb index e36f507..92f60e9 100644 --- a/app/models/seminar_main.rb +++ b/app/models/seminar_main.rb @@ -296,7 +296,7 @@ class SeminarMain end def map_seminar_signup_ids(old_seminar_signup_ids) if @records_all["seminar_signup_ids"].present? - old_seminar_signup_ids.map{|seminar_signup_id| @records_all["seminar_signup_ids"][BSON::ObjectId(seminar_signup_id)]} + old_seminar_signup_ids.map{|seminar_signup_id| @records_all["seminar_signup_ids"][BSON::ObjectId(seminar_signup_id)].to_s rescue ""}.select{|t| t.present?} else [] end diff --git a/app/models/seminar_review.rb b/app/models/seminar_review.rb index ec4e9e1..d2106fe 100644 --- a/app/models/seminar_review.rb +++ b/app/models/seminar_review.rb @@ -73,8 +73,8 @@ class SeminarReview end def get_all_seminar_signup_ids(mode = nil) if (self.default_topics.include?("seminar_signup_contributes.description") && self.seminar_main.assign_mode == 1) || mode == 1 - final_assign_signup_ids = SeminarSession.where(:id.in=>self.seminar_session_ids).pluck(:seminar_signup_ids).flatten rescue [] - self.seminar_signup_ids - self.remove_seminar_signup_ids + final_assign_signup_ids + final_assign_signup_ids = SeminarSession.where(:id.in=>self.seminar_session_ids).pluck(:seminar_signup_ids).flatten.map{|id| id.to_s} rescue [] + final_assign_signup_ids + self.seminar_signup_ids - self.remove_seminar_signup_ids else all_seminar_signup_ids end diff --git a/app/views/admin/seminars/_seminar_signup_dashboard.html.erb b/app/views/admin/seminars/_seminar_signup_dashboard.html.erb index 9549b74..4e32378 100644 --- a/app/views/admin/seminars/_seminar_signup_dashboard.html.erb +++ b/app/views/admin/seminars/_seminar_signup_dashboard.html.erb @@ -1,7 +1,7 @@

<%= @seminar.title %>

<% org_seminar_signups = @seminar_signups %> -
+

<%= t("seminar.reviewer") %>

<% reviewer_show_ids = @seminar.reviewer_show_ids %> <% if reviewer_show_ids.nil? @@ -65,6 +65,14 @@
<% if @can_edit %> + <% if params[:type].blank?%> + + <% end %>