mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-01 12:24:28 +01:00
[bug] wrong statistics about hours available for reservation
This commit is contained in:
parent
5b7e8474d4
commit
9edf723373
@ -6,7 +6,9 @@
|
||||
- Fix a bug: display more than 15 unread notifications (number on the bell icon & full list)
|
||||
- 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 reservation. Fix requires user action (1)
|
||||
- [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)
|
||||
|
||||
## v2.4.8 2016 December 15
|
||||
|
||||
|
@ -97,6 +97,8 @@ class Availability < ActiveRecord::Base
|
||||
def as_indexed_json
|
||||
json = JSON.parse(to_json)
|
||||
json['hours_duration'] = (end_at - start_at) / (60 * 60)
|
||||
json['machines'] = machines_availabilities.map{|ma| ma.machine.friendly_id}
|
||||
json['bookable_hours'] = json['hours_duration'] * json['machines'].length
|
||||
json.to_json
|
||||
end
|
||||
|
||||
|
@ -407,7 +407,7 @@ if StatisticCustomAggregation.count == 0
|
||||
es_index: 'fablab',
|
||||
es_type: 'availabilities',
|
||||
field: 'available_hours',
|
||||
query: '{"size":0, "aggregations":{"%{aggs_name}":{"sum":{"field":"hours_duration"}}}, "query":{"bool":{"must":[{"range":{"start_at":{"gte":"%{start_date}", "lte":"%{end_date}"}}}, {"match":{"available_type":"machines"}}]}}}'
|
||||
query: '{"size":0, "aggregations":{"%{aggs_name}":{"sum":{"field":"bookable_hours"}}}, "query":{"bool":{"must":[{"range":{"start_at":{"gte":"%{start_date}", "lte":"%{end_date}"}}}, {"match":{"available_type":"machines"}}]}}}'
|
||||
})
|
||||
available_hours.save!
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
query: '{"size":0, "aggregations":{"%{aggs_name}":{"sum":{"field":"hours_duration"}}}, "query":{"bool":{"must":[{"range":{"start_at":{"gte":"%{start_date}", "lte":"%{end_date}"}}}, {"match":{"available_type":"machines"}}]}}}'
|
||||
query: '{"size":0, "aggregations":{"%{aggs_name}":{"sum":{"field":"bookable_hours"}}}, "query":{"bool":{"must":[{"range":{"start_at":{"gte":"%{start_date}", "lte":"%{end_date}"}}}, {"match":{"available_type":"machines"}}]}}}'
|
||||
statistic_type_id: 2
|
||||
field: "available_hours"
|
||||
es_index: "fablab"
|
||||
|
Loading…
Reference in New Issue
Block a user