diff --git a/app/controllers/api/v0/competitions_controller.rb b/app/controllers/api/v0/competitions_controller.rb index ad1f6af811..5f9e81007f 100644 --- a/app/controllers/api/v0/competitions_controller.rb +++ b/app/controllers/api/v0/competitions_controller.rb @@ -29,7 +29,7 @@ def competition_index serial_includes = {} serial_includes["delegates"] = { only: ["id", "name"], methods: [], include: ["avatar"] } if admin_mode - serial_methods |= ["results_submitted_at", "report_posted_at"] if admin_mode + serial_methods |= ["results_submitted_at", "results_posted_at", "report_posted_at", "report_posted_by_user"] if admin_mode paginate json: competitions, only: ["id", "name", "start_date", "end_date", "registration_open", "registration_close", "venue"], diff --git a/app/models/competition.rb b/app/models/competition.rb index 0ec9f0ebb1..3610f69bc1 100644 --- a/app/models/competition.rb +++ b/app/models/competition.rb @@ -838,6 +838,10 @@ def report_posted_at delegate_report&.posted_at end + def report_posted_by_user + delegate_report&.posted_by_user_id + end + # This callback updates all tables having the competition id, when the id changes. # This should be deleted after competition id is made immutable: https://github.com/thewca/worldcubeassociation.org/pull/381 after_save :update_foreign_keys, if: :saved_change_to_id? diff --git a/app/webpacker/components/CompetitionsOverview/ListViewSection.js b/app/webpacker/components/CompetitionsOverview/ListViewSection.js index 5b692556b5..498eaa9bde 100644 --- a/app/webpacker/components/CompetitionsOverview/ListViewSection.js +++ b/app/webpacker/components/CompetitionsOverview/ListViewSection.js @@ -16,8 +16,8 @@ import { isProbablyOver, PseudoLinkMarkdown, reportAdminCellContent, + resultsSubmittedAtAdminCellContent, startYear, - timeDifferenceAfter, timeDifferenceBefore, } from '../../lib/utils/competition-table'; import { countries } from '../../lib/wca-data.js.erb'; @@ -390,11 +390,7 @@ function AdminCompetitionsTable({ warning={resultsPostedStatus === 'warning'} error={resultsPostedStatus === 'danger'} > - { - comp.results_posted_at - ? timeDifferenceAfter(comp, comp.results_posted_at) - : (isProbablyOver(comp) && I18n.t('competitions.competition_info.pending')) - } + {resultsSubmittedAtAdminCellContent(comp)}