1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

Ability to fully rebuild the projets index in ElasticSearch with rake fablab🇪🇸build_projects_index

This commit is contained in:
Sylvain 2019-10-16 14:37:43 +02:00
parent 4300f29ad7
commit 1cc1bd23b7
3 changed files with 15 additions and 1 deletions

View File

@ -10,6 +10,7 @@
- Ability to bulk-import members from a CSV file
- Ability to disable invoices generation and interfaces
- Added a known issue to the README (#152)
- Ability to fully rebuild the projets index in ElasticSearch with rake fablab:es:build_projects_index
- Fix a bug: invoices with total = 0, are marked as paid on site even if paid by card
- Fix a bug: after disabling a group, its associated plans are hidden from the interface
- Fix a bug: in case of unexpected server error during stripe payment process, the confirm button is not unlocked

View File

@ -11,6 +11,6 @@ class AddSlugToTrainings < ActiveRecord::Migration
def down
remove_column :trainings, :slug, :string
remove_index :trainings, :slug, unique: true
remove_index :trainings, :slug
end
end

View File

@ -104,6 +104,19 @@ namespace :fablab do
desc 'sync all/one project in ElasticSearch index'
task :build_projects_index, [:id] => :environment do |_task, args|
client = Project.__elasticsearch__.client
# ask if we delete the index
print 'Delete all projects in ElasticSearch index? (y/n) '
confirm = STDIN.gets.chomp
if confirm == 'y'
client.delete_by_query(
index: Project.index_name,
type: Project.document_type,
conflicts: 'proceed',
body: { query: { match_all: {} } }
)
end
# create index if not exists
Project.__elasticsearch__.create_index! force: true unless client.indices.exists? index: Project.index_name