From 2ef13e738d47110c61d411ab46ec525ad02c45e6 Mon Sep 17 00:00:00 2001 From: martintomas Date: Tue, 26 Nov 2024 13:57:28 +0100 Subject: [PATCH] fix: Show only published publications and articles --- app/controllers/tpi/ascor_controller.rb | 4 ++-- app/controllers/tpi/banks_controller.rb | 1 + app/views/tpi/home/index.html.erb | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/controllers/tpi/ascor_controller.rb b/app/controllers/tpi/ascor_controller.rb index b20de61b1..34d07899a 100644 --- a/app/controllers/tpi/ascor_controller.rb +++ b/app/controllers/tpi/ascor_controller.rb @@ -9,8 +9,8 @@ class ASCORController < TPIController def index @assessment_dates = ASCOR::Assessment.pluck(:assessment_date).uniq @publications_and_articles = ( - Publication.joins(:tags).includes(:tpi_sectors).where(tags: {name: 'ASCOR'}) + - NewsArticle.joins(:tags).where(tags: {name: 'ASCOR'}) + Publication.published.joins(:tags).includes(:tpi_sectors).where(tags: {name: 'ASCOR'}) + + NewsArticle.published.joins(:tags).where(tags: {name: 'ASCOR'}) ).uniq.sort_by(&:publication_date).reverse!.take(3) ascor_page = TPIPage.find_by(slug: 'ascor') @methodology_description = Content.find_by(page: ascor_page, code: 'methodology_description') diff --git a/app/controllers/tpi/banks_controller.rb b/app/controllers/tpi/banks_controller.rb index 5d29266c1..3ce1c72ee 100644 --- a/app/controllers/tpi/banks_controller.rb +++ b/app/controllers/tpi/banks_controller.rb @@ -12,6 +12,7 @@ class BanksController < TPIController def index @assessment_dates = BankAssessment.select(:assessment_date).distinct.pluck(:assessment_date) @publications_and_articles = TPISector.find_by(slug: 'banks')&.publications_and_articles || [] + @publications_and_articles = @publications_and_articles.select { |pa| pa.publication_date <= Time.current } bank_page = TPIPage.find_by(slug: 'banks-content') @methodology_description = Content.find_by( page: bank_page, diff --git a/app/views/tpi/home/index.html.erb b/app/views/tpi/home/index.html.erb index f9929994f..0a4f9705b 100644 --- a/app/views/tpi/home/index.html.erb +++ b/app/views/tpi/home/index.html.erb @@ -145,7 +145,9 @@ <% @latest_researches.each_with_index do |research, index| %>
<%= link_to tpi_publication_download_file_path(slug: research.slug, format: format_of(research.file)), target: '_blank', class: 'research-box' do %> - + <% if research.image.present? %> + + <% end %>
<% if research.author_image.present? %>