diff --git a/CHANGELOG.md b/CHANGELOG.md index f2bf649ba..3830e7098 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog Fab-manager +## v5.1.5 2021 August 2 + +- Fix a bug: unable to show statistics +- [TODO DEPLOY] `rails fablab:maintenance:regenerate_statistics[2021,6]` + ## v5.1.4 2021 July 9 - Fix a bug: stripe 3D Secure payment @@ -34,6 +39,11 @@ - [TODO DEPLOY] `rails db:seed` - [TODO DEPLOY] `rails fablab:maintenance:rebuild_stylesheet` +## v5.0.10 2021 August 2 + +- Fix a bug: unable to show statistics +- [TODO DEPLOY] `rails fablab:maintenance:regenerate_statistics[2021,6]` + ## v5.0.9 2021 July 9 - Fix a bug: stripe 3D Secure payment diff --git a/lib/tasks/fablab/maintenance.rake b/lib/tasks/fablab/maintenance.rake index 4b0956e8b..2924d38e8 100644 --- a/lib/tasks/fablab/maintenance.rake +++ b/lib/tasks/fablab/maintenance.rake @@ -108,5 +108,23 @@ namespace :fablab do end end end + + desc 'regenerate statistics' + task :regenerate_statistics, %i[year month] => :environment do |_task, args| + return unless Setting.get('statistics_module') + + yesterday = 1.day.ago + year = args.year || yesterday.year + month = args.month || yesterday.month + start_date = Time.zone.local(year.to_i, month.to_i, 1) + end_date = yesterday.end_of_day + puts "-> Start regenerate statistics between #{I18n.l start_date, format: :long} and " \ + "#{I18n.l end_date, format: :long}" + StatisticService.new.generate_statistic( + start_date: start_date, + end_date: end_date + ) + puts '-> Done' + end end end diff --git a/package.json b/package.json index f9108d24a..4a84c4c54 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fab-manager", - "version": "5.1.4", + "version": "5.1.5", "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",