mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-29 10:24:20 +01:00
[bug] regenerate statistics does not remove all previous values
This commit is contained in:
parent
8119f54e4c
commit
e656b7d784
@ -9,6 +9,7 @@
|
||||
- Fix a bug: in invoice configuration panel, VAT amount and total excl. taxes are inverted
|
||||
- Fix a bug: unable to compute user's age when they were born on february 29th and current year is not a leap year
|
||||
- Fix a bug: wrong statistics about hours available for machines reservation. Fix requires user action (1)
|
||||
- Fix a bug: when regenerating statistics, previous values are not fully removed (only 10 firsts), resulting in wrong statistics generation
|
||||
- [TODO DEPLOY] remove possible value `application/` in `ALLOWED_MIME_TYPES` list, in environment variable
|
||||
- [TODO DEPLOY] `rails runner StatisticCustomAggregation.destroy_all`, then `rake db:seed`, then `rake fablab:es_build_availabilities_index` (1)
|
||||
|
||||
|
@ -297,8 +297,10 @@ class StatisticService
|
||||
end
|
||||
|
||||
def clean_stat(options = default_options)
|
||||
client = Elasticsearch::Model.client
|
||||
%w{Account Event Machine Project Subscription Training User}.each do |o|
|
||||
"Stats::#{o}".constantize.search(query: {match: {date: format_date(options[:start_date])}}).results.each(&:destroy)
|
||||
model = "Stats::#{o}".constantize
|
||||
client.delete_by_query(index: model.index_name, type: model.document_type, body: {query: {match: {date: format_date(options[:start_date])}}})
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user