1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-20 14:54:15 +01:00

(bug) unable to generate statistics

This bug is due to the refactoring of the statistics builder service,
in 2022 august. The default_options were not defined so the nightly
worker has no luck to run. The statistics may not have been built since
then, so a rebuild is required
This commit is contained in:
Sylvain 2022-10-05 13:11:17 +02:00
parent 51aa967001
commit 2b80516177
3 changed files with 16 additions and 0 deletions

View File

@ -1,6 +1,8 @@
# Changelog Fab-manager
- Ability to dismiss a user to a lower privileged role
- Fix a bug: unable to generate statistics
- [TODO DEPLOY] `rails fablab:maintenance:regenerate_statistics[2022,08]`
## v5.4.20 2022 September 27

View File

@ -12,5 +12,15 @@ class Statistics::BuilderService
Statistics::Builders::MembersBuilderService.build(options)
Statistics::Builders::ProjectsBuilderService.build(options)
end
private
def default_options
yesterday = 1.day.ago
{
start_date: yesterday.beginning_of_day,
end_date: yesterday.end_of_day
}
end
end
end

View File

@ -9,6 +9,10 @@ class StatisticServiceTest < ActionDispatch::IntegrationTest
login_as(@admin, scope: :user)
end
test 'build default stats' do
::Statistics::BuilderService.generate_statistic
end
test 'build stats' do
# Create a reservation to generate an invoice
machine = Machine.find(1)