Add search method to polls

So far the method does not take questions nor answers into account.

This way we'll be able to search polls in the SDG Management section.
This commit is contained in:
Javi Martín
2020-12-16 14:24:24 +01:00
parent 00910b82a3
commit 852014e478
7 changed files with 75 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ namespace :consul do
desc "Runs tasks needed to upgrade from 1.2.0 to 1.3.0"
task "execute_release_1.3.0_tasks": [
"db:load_sdg"
"db:load_sdg",
"db:calculate_tsv"
]
end

View File

@@ -10,4 +10,9 @@ namespace :db do
ApplicationLogger.new.info "Adding Sustainable Development Goals content"
load(Rails.root.join("db", "sdg.rb"))
end
desc "Calculates the TSV column for all polls"
task calculate_tsv: :environment do
Poll.find_each(&:calculate_tsvector)
end
end