1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00

Merge branch 'dev' for release 6.0.6

This commit is contained in:
Du Peng 2023-05-04 14:45:23 +02:00
commit da72ee63ac
7 changed files with 16 additions and 8 deletions

View File

@ -1,5 +1,10 @@
# Changelog Fab-manager
## v6.0.6 2023 May 4
- Fix a bug: invalid duration for machine/spaces reservations in statistics, when using slots of not 1 hour
- [TODO DEPLOY] `rails fablab:es:build_stats` THEN `rails fablab:maintenance:regenerate_statistics[2014,1]`
## v6.0.5 2023 May 2
- Fix a bug: unable to show calendar for Firefox and Safari

View File

@ -269,6 +269,8 @@ GEM
net-smtp (0.3.3)
net-protocol
nio4r (2.5.8)
nokogiri (1.14.3-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.14.3-x86_64-linux)
racc (~> 1.4)
oauth2 (1.4.4)
@ -524,6 +526,7 @@ GEM
zeitwerk (2.6.7)
PLATFORMS
x86_64-darwin-20
x86_64-linux
DEPENDENCIES

View File

@ -41,7 +41,7 @@ module ExcelHelper
unless type.simple
data.push hit['_source']['stat']
styles.push nil
types.push :string
types.push :float
end
[data, styles, types]

View File

@ -8,7 +8,7 @@ module StatConcern
attribute :type, String
attribute :subType, String
attribute :date, String
attribute :stat, Integer
attribute :stat, Float
attribute :userId, Integer
attribute :gender, String
attribute :age, Integer

View File

@ -39,11 +39,11 @@ module Statistics::Concerns::HelpersConcern
def difference_in_hours(start_at, end_at)
if start_at.to_date == end_at.to_date
((end_at - start_at) / 3600.0).to_i
((end_at - start_at) / 3600.0).to_f
else
end_at_to_start_date = end_at.change(year: start_at.year, month: start_at.month, day: start_at.day)
hours = ((end_at_to_start_date - start_at) / 60 / 60).to_i
hours = ((end_at.to_date - start_at.to_date).to_i + 1) * hours if end_at.to_date > start_at.to_date
hours = ((end_at_to_start_date - start_at) / 60 / 60).to_f
hours = ((end_at.to_date - start_at.to_date).to_f + 1) * hours if end_at.to_date > start_at.to_date
hours
end
end

View File

@ -57,7 +57,7 @@ class Statistics::FetcherService
machine_type: r.reservable.friendly_id,
machine_name: r.reservable.name,
slot_dates: r.slots.map(&:start_at).map(&:to_date),
nb_hours: (r.slots.map(&:duration).map(&:to_i).reduce(:+) / 3600.0).to_i,
nb_hours: (r.slots.map(&:duration).map(&:to_i).reduce(:+) / 3600.0).to_f,
ca: calcul_ca(r.original_invoice) }.merge(user_info(profile))
yield result
end
@ -81,7 +81,7 @@ class Statistics::FetcherService
space_name: r.reservable.name,
space_type: r.reservable.slug,
slot_dates: r.slots.map(&:start_at).map(&:to_date),
nb_hours: (r.slots.map(&:duration).map(&:to_i).reduce(:+) / 3600.0).to_i,
nb_hours: (r.slots.map(&:duration).map(&:to_i).reduce(:+) / 3600.0).to_f,
ca: calcul_ca(r.original_invoice) }.merge(user_info(profile))
yield result
end

View File

@ -1,6 +1,6 @@
{
"name": "fab-manager",
"version": "6.0.5",
"version": "6.0.6",
"description": "Fab-manager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks and your marker's projects.",
"keywords": [
"fablab",