From 5402516f9649787dd8ca89fc5e412598d33e9608 Mon Sep 17 00:00:00 2001 From: Kostiantyn Kostiuk Date: Fri, 10 Nov 2023 21:12:12 +0200 Subject: [PATCH] Add judge result generate button into judge UI Resolves: #425 Signed-off-by: Kostiantyn Kostiuk --- app/controllers/judges_controller.rb | 4 ++++ app/views/results/index.html.erb | 4 ++++ config/routes.rb | 1 + 3 files changed, 9 insertions(+) diff --git a/app/controllers/judges_controller.rb b/app/controllers/judges_controller.rb index 9b3439aa..58ae2f77 100644 --- a/app/controllers/judges_controller.rb +++ b/app/controllers/judges_controller.rb @@ -3,6 +3,10 @@ def users_csv send_data UsersList.new(contest, params[:separator]).build_csv, filename: 'users-list.csv' end + def judge_xlsx + send_file Spreadsheet::Judge.new(contest).build + end + def destroy session.clear redirect_to :root diff --git a/app/views/results/index.html.erb b/app/views/results/index.html.erb index f31ecee3..98b627e1 100644 --- a/app/views/results/index.html.erb +++ b/app/views/results/index.html.erb @@ -1,5 +1,9 @@

Результати олімпіади

+<% if judge? %> +

<%= link_to 'Таблиця результатів для журі', [:judge_xlsx, contest, :judge] %>

+<% end %> + <% if contest.preliminary_results.attached? %>

<%= link_to 'Попередні результати', contest.preliminary_results %>

<% end %> diff --git a/config/routes.rb b/config/routes.rb index 4c531a78..984ff696 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -16,6 +16,7 @@ resource :judge, only: %i[show destroy] do get :users_csv + get :judge_xlsx end end