Skip to content

Commit 18fe5cd

Browse files
committed
Merge branch 'dev' for release 6.4.2
2 parents 1893559 + d72be58 commit 18fe5cd

File tree

6 files changed

+74
-66
lines changed

6 files changed

+74
-66
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## Next release
44

5+
## v6.4.2 2025 Jun 16
6+
7+
- Fix a bug: reservation of training has auto canceled/refunded two times
8+
- Fix a bug: missing reservation of space in open api json
9+
- Fix a bug: unable to run rails db:migrate
10+
511
## v6.4.1 2025 Avril 30
612

713
- Fix a bug: unable to migrate coupon usages

app/services/trainings/auto_cancel_service.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def auto_cancel_reservations(training)
1717
Time.current,
1818
Time.current + training.auto_cancel_deadline.hours)
1919
.find_each do |availability|
20-
next if availability.reservations.count >= training.auto_cancel_threshold
20+
next if availability.slots_reservations.where(canceled_at: nil).count >= training.auto_cancel_threshold
2121

2222
auto_refund = Setting.get('wallet_module')
2323

@@ -27,14 +27,14 @@ def auto_cancel_reservations(training)
2727
meta_data: { auto_refund: auto_refund }
2828

2929
availability.update(lock: true)
30-
availability.slots_reservations.find_each do |sr|
30+
availability.slots_reservations.where(canceled_at: nil).find_each do |sr|
3131
NotificationCenter.call type: 'notify_member_training_auto_cancelled',
3232
receiver: sr.reservation.user,
3333
attached_object: sr,
34-
meta_data: { auto_refund: auto_refund }
34+
meta_data: { auto_refund: auto_refund && !sr.offered? }
3535

36-
sr.update(canceled_at: Time.current)
37-
refund_after_cancel(sr.reservation) if auto_refund
36+
SlotsReservationsService.cancel(sr)
37+
refund_after_cancel(sr.reservation) if auto_refund && !sr.offered?
3838
end
3939
end
4040
end

app/views/open_api/v1/reservations/index.json.jbuilder

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ json.reservations @reservations do |reservation|
1818
json.partial! 'open_api/v1/trainings/training', training: reservation.reservable
1919
when 'Machine'
2020
json.partial! 'open_api/v1/machines/machine', machine: reservation.reservable
21+
when 'Space'
22+
json.partial! 'open_api/v1/spaces/space', space: reservation.reservable
2123
when 'Event'
2224
json.partial! 'open_api/v1/events/event', event: reservation.reservable
2325
end

db/migrate/20230828073428_add_roles_to_notification_types.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ class AddRolesToNotificationTypes < ActiveRecord::Migration[7.0]
22
def change
33
add_column :notification_types, :roles, :string, array: true, default: []
44
add_index :notification_types, :roles
5-
load Rails.root.join('db/seeds/notification_types.rb')
65
end
76
end

db/migrate/20231103093436_add_label_i18n_path_to_statistic_tables.rb

Lines changed: 60 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -7,91 +7,92 @@ def change
77

88
# StatisticIndex
99

10-
statistic_index_subscription = StatisticIndex.find_by!(es_type_key: 'subscription')
11-
statistic_index_subscription.update!(label: nil, label_i18n_path: 'statistics.subscriptions')
10+
if StatisticIndex.count > 0
11+
statistic_index_subscription = StatisticIndex.find_by!(es_type_key: 'subscription')
12+
statistic_index_subscription.update!(label: nil, label_i18n_path: 'statistics.subscriptions')
1213

13-
statistic_index_machine = StatisticIndex.find_by!(es_type_key: 'machine')
14-
statistic_index_machine.update!(label: nil, label_i18n_path: 'statistics.machines_hours')
14+
statistic_index_machine = StatisticIndex.find_by!(es_type_key: 'machine')
15+
statistic_index_machine.update!(label: nil, label_i18n_path: 'statistics.machines_hours')
1516

16-
statistic_index_training = StatisticIndex.find_by!(es_type_key: 'training')
17-
statistic_index_training.update!(label: nil, label_i18n_path: 'statistics.trainings')
17+
statistic_index_training = StatisticIndex.find_by!(es_type_key: 'training')
18+
statistic_index_training.update!(label: nil, label_i18n_path: 'statistics.trainings')
1819

19-
statistic_index_event = StatisticIndex.find_by!(es_type_key: 'event')
20-
statistic_index_event.update!(label: nil, label_i18n_path: 'statistics.events')
20+
statistic_index_event = StatisticIndex.find_by!(es_type_key: 'event')
21+
statistic_index_event.update!(label: nil, label_i18n_path: 'statistics.events')
2122

22-
statistic_index_account = StatisticIndex.find_by!(es_type_key: 'account')
23-
statistic_index_account.update!(label: nil, label_i18n_path: 'statistics.registrations')
23+
statistic_index_account = StatisticIndex.find_by!(es_type_key: 'account')
24+
statistic_index_account.update!(label: nil, label_i18n_path: 'statistics.registrations')
2425

25-
statistic_index_project = StatisticIndex.find_by!(es_type_key: 'project')
26-
statistic_index_project.update!(label: nil, label_i18n_path: 'statistics.projects')
26+
statistic_index_project = StatisticIndex.find_by!(es_type_key: 'project')
27+
statistic_index_project.update!(label: nil, label_i18n_path: 'statistics.projects')
2728

28-
statistic_index_user = StatisticIndex.find_by!(es_type_key: 'user')
29-
statistic_index_user.update!(label: nil, label_i18n_path: 'statistics.users')
29+
statistic_index_user = StatisticIndex.find_by!(es_type_key: 'user')
30+
statistic_index_user.update!(label: nil, label_i18n_path: 'statistics.users')
3031

31-
statistic_index_space = StatisticIndex.find_by!(es_type_key: 'space')
32-
statistic_index_space.update!(label: nil, label_i18n_path: 'statistics.spaces')
32+
statistic_index_space = StatisticIndex.find_by!(es_type_key: 'space')
33+
statistic_index_space.update!(label: nil, label_i18n_path: 'statistics.spaces')
3334

34-
statistic_index_order = StatisticIndex.find_by!(es_type_key: 'order')
35-
statistic_index_order.update!(label: nil, label_i18n_path: 'statistics.orders')
35+
statistic_index_order = StatisticIndex.find_by!(es_type_key: 'order')
36+
statistic_index_order.update!(label: nil, label_i18n_path: 'statistics.orders')
3637

37-
# StatisticField
38+
# StatisticField
3839

39-
if StatisticField.count > 0
40-
StatisticField.find_by!(key: 'groupName', statistic_index_id: statistic_index_subscription.id).update!(label: nil, label_i18n_path: 'statistics.group')
40+
if StatisticField.count > 0
41+
StatisticField.find_by!(key: 'groupName', statistic_index_id: statistic_index_subscription.id).update!(label: nil, label_i18n_path: 'statistics.group')
4142

42-
StatisticField.find_by!(key: 'spaceDates', statistic_index_id: statistic_index_space.id).update!(label: nil, label_i18n_path: 'statistics.space_dates')
43-
StatisticField.find_by!(key: 'groupName', statistic_index_id: statistic_index_space.id).update!(label: nil, label_i18n_path: 'statistics.group')
43+
StatisticField.find_by!(key: 'spaceDates', statistic_index_id: statistic_index_space.id).update!(label: nil, label_i18n_path: 'statistics.space_dates')
44+
StatisticField.find_by!(key: 'groupName', statistic_index_id: statistic_index_space.id).update!(label: nil, label_i18n_path: 'statistics.group')
4445

45-
StatisticField.find_by!(key: 'machineDates', statistic_index_id: statistic_index_machine.id).update!(label: nil, label_i18n_path: 'statistics.machine_dates')
46-
StatisticField.find_by!(key: 'groupName', statistic_index_id: statistic_index_machine.id).update!(label: nil, label_i18n_path: 'statistics.group')
46+
StatisticField.find_by!(key: 'machineDates', statistic_index_id: statistic_index_machine.id).update!(label: nil, label_i18n_path: 'statistics.machine_dates')
47+
StatisticField.find_by!(key: 'groupName', statistic_index_id: statistic_index_machine.id).update!(label: nil, label_i18n_path: 'statistics.group')
4748

49+
StatisticField.find_by!(key: 'trainingId', statistic_index_id: statistic_index_training.id).update!(label: nil, label_i18n_path: 'statistics.training_id')
50+
StatisticField.find_by!(key: 'trainingDate', statistic_index_id: statistic_index_training.id).update!(label: nil, label_i18n_path: 'statistics.training_date')
51+
StatisticField.find_by!(key: 'groupName', statistic_index_id: statistic_index_training.id).update!(label: nil, label_i18n_path: 'statistics.group')
4852

49-
StatisticField.find_by!(key: 'trainingId', statistic_index_id: statistic_index_training.id).update!(label: nil, label_i18n_path: 'statistics.training_id')
50-
StatisticField.find_by!(key: 'trainingDate', statistic_index_id: statistic_index_training.id).update!(label: nil, label_i18n_path: 'statistics.training_date')
51-
StatisticField.find_by!(key: 'groupName', statistic_index_id: statistic_index_training.id).update!(label: nil, label_i18n_path: 'statistics.group')
53+
StatisticField.find_by!(key: 'name', statistic_index_id: statistic_index_event.id).update!(label: nil, label_i18n_path: 'statistics.event_name')
54+
StatisticField.find_by!(key: 'eventId', statistic_index_id: statistic_index_event.id).update!(label: nil, label_i18n_path: 'statistics.event_id')
55+
StatisticField.find_by!(key: 'eventDate', statistic_index_id: statistic_index_event.id).update!(label: nil, label_i18n_path: 'statistics.event_date')
56+
StatisticField.find_by!(key: 'groupName', statistic_index_id: statistic_index_event.id).update!(label: nil, label_i18n_path: 'statistics.group')
57+
StatisticField.find_by!(key: 'eventTheme', statistic_index_id: statistic_index_event.id).update!(label: nil, label_i18n_path: 'statistics.event_theme')
58+
StatisticField.find_by!(key: 'ageRange', statistic_index_id: statistic_index_event.id).update!(label: nil, label_i18n_path: 'statistics.age_range')
5259

53-
StatisticField.find_by!(key: 'name', statistic_index_id: statistic_index_event.id).update!(label: nil, label_i18n_path: 'statistics.event_name')
54-
StatisticField.find_by!(key: 'eventId', statistic_index_id: statistic_index_event.id).update!(label: nil, label_i18n_path: 'statistics.event_id')
55-
StatisticField.find_by!(key: 'eventDate', statistic_index_id: statistic_index_event.id).update!(label: nil, label_i18n_path: 'statistics.event_date')
56-
StatisticField.find_by!(key: 'groupName', statistic_index_id: statistic_index_event.id).update!(label: nil, label_i18n_path: 'statistics.group')
57-
StatisticField.find_by!(key: 'eventTheme', statistic_index_id: statistic_index_event.id).update!(label: nil, label_i18n_path: 'statistics.event_theme')
58-
StatisticField.find_by!(key: 'ageRange', statistic_index_id: statistic_index_event.id).update!(label: nil, label_i18n_path: 'statistics.age_range')
60+
StatisticField.find_by!(key: 'groupName', statistic_index_id: statistic_index_account.id).update!(label: nil, label_i18n_path: 'statistics.group')
5961

60-
StatisticField.find_by!(key: 'groupName', statistic_index_id: statistic_index_account.id).update!(label: nil, label_i18n_path: 'statistics.group')
62+
StatisticField.find_by!(key: 'themes', statistic_index_id: statistic_index_project.id).update!(label: nil, label_i18n_path: 'statistics.themes')
63+
StatisticField.find_by!(key: 'components', statistic_index_id: statistic_index_project.id).update!(label: nil, label_i18n_path: 'statistics.components')
64+
StatisticField.find_by!(key: 'machines', statistic_index_id: statistic_index_project.id).update!(label: nil, label_i18n_path: 'statistics.machines')
65+
StatisticField.find_by!(key: 'status', statistic_index_id: statistic_index_project.id).update!(label: nil, label_i18n_path: 'statistics.project_status')
66+
StatisticField.find_by!(key: 'name', statistic_index_id: statistic_index_project.id).update!(label: nil, label_i18n_path: 'statistics.project_name')
67+
StatisticField.find_by!(key: 'projectUserNames', statistic_index_id: statistic_index_project.id).update!(label: nil, label_i18n_path: 'statistics.project_user_names')
6168

62-
StatisticField.find_by!(key: 'themes', statistic_index_id: statistic_index_project.id).update!(label: nil, label_i18n_path: 'statistics.themes')
63-
StatisticField.find_by!(key: 'components', statistic_index_id: statistic_index_project.id).update!(label: nil, label_i18n_path: 'statistics.components')
64-
StatisticField.find_by!(key: 'machines', statistic_index_id: statistic_index_project.id).update!(label: nil, label_i18n_path: 'statistics.machines')
65-
StatisticField.find_by!(key: 'status', statistic_index_id: statistic_index_project.id).update!(label: nil, label_i18n_path: 'statistics.project_status')
66-
StatisticField.find_by!(key: 'name', statistic_index_id: statistic_index_project.id).update!(label: nil, label_i18n_path: 'statistics.project_name')
67-
StatisticField.find_by!(key: 'projectUserNames', statistic_index_id: statistic_index_project.id).update!(label: nil, label_i18n_path: 'statistics.project_user_names')
69+
StatisticField.find_by!(key: 'userId', statistic_index_id: statistic_index_user.id).update!(label: nil, label_i18n_path: 'statistics.user_id')
6870

69-
StatisticField.find_by!(key: 'userId', statistic_index_id: statistic_index_user.id).update!(label: nil, label_i18n_path: 'statistics.user_id')
71+
StatisticField.find_by!(key: 'groupName', statistic_index_id: statistic_index_order.id).update!(label: nil, label_i18n_path: 'statistics.group')
72+
end
7073

71-
StatisticField.find_by!(key: 'groupName', statistic_index_id: statistic_index_order.id).update!(label: nil, label_i18n_path: 'statistics.group')
72-
end
73-
74-
# StatisticType
75-
if StatisticType.count > 0
76-
StatisticType.find_by!(key: 'booking', statistic_index_id: statistic_index_machine.id).update!(label: nil, label_i18n_path: 'statistics.bookings')
77-
StatisticType.find_by!(key: 'hour', statistic_index_id: statistic_index_machine.id).update!(label: nil, label_i18n_path: 'statistics.hours_number')
74+
# StatisticType
75+
if StatisticType.count > 0
76+
StatisticType.find_by!(key: 'booking', statistic_index_id: statistic_index_machine.id).update!(label: nil, label_i18n_path: 'statistics.bookings')
77+
StatisticType.find_by!(key: 'hour', statistic_index_id: statistic_index_machine.id).update!(label: nil, label_i18n_path: 'statistics.hours_number')
7878

79-
StatisticType.find_by!(key: 'booking', statistic_index_id: statistic_index_training.id).update!(label: nil, label_i18n_path: 'statistics.bookings')
80-
StatisticType.find_by!(key: 'hour', statistic_index_id: statistic_index_training.id).update!(label: nil, label_i18n_path: 'statistics.hours_number')
79+
StatisticType.find_by!(key: 'booking', statistic_index_id: statistic_index_training.id).update!(label: nil, label_i18n_path: 'statistics.bookings')
80+
StatisticType.find_by!(key: 'hour', statistic_index_id: statistic_index_training.id).update!(label: nil, label_i18n_path: 'statistics.hours_number')
8181

82-
StatisticType.find_by!(key: 'booking', statistic_index_id: statistic_index_event.id).update!(label: nil, label_i18n_path: 'statistics.tickets_number')
83-
StatisticType.find_by!(key: 'hour', statistic_index_id: statistic_index_event.id).update!(label: nil, label_i18n_path: 'statistics.hours_number')
82+
StatisticType.find_by!(key: 'booking', statistic_index_id: statistic_index_event.id).update!(label: nil, label_i18n_path: 'statistics.tickets_number')
83+
StatisticType.find_by!(key: 'hour', statistic_index_id: statistic_index_event.id).update!(label: nil, label_i18n_path: 'statistics.hours_number')
8484

85-
StatisticType.find_by!(key: 'member', statistic_index_id: statistic_index_account.id).update!(label: nil, label_i18n_path: 'statistics.users')
85+
StatisticType.find_by!(key: 'member', statistic_index_id: statistic_index_account.id).update!(label: nil, label_i18n_path: 'statistics.users')
8686

87-
StatisticType.find_by!(key: 'project', statistic_index_id: statistic_index_project.id).update!(label: nil, label_i18n_path: 'statistics.projects')
87+
StatisticType.find_by!(key: 'project', statistic_index_id: statistic_index_project.id).update!(label: nil, label_i18n_path: 'statistics.projects')
8888

89-
StatisticType.find_by!(key: 'revenue', statistic_index_id: statistic_index_user.id).update!(label: nil, label_i18n_path: 'statistics.revenue')
89+
StatisticType.find_by!(key: 'revenue', statistic_index_id: statistic_index_user.id).update!(label: nil, label_i18n_path: 'statistics.revenue')
9090

91-
StatisticType.find_by!(key: 'booking', statistic_index_id: statistic_index_space.id).update!(label: nil, label_i18n_path: 'statistics.bookings')
92-
StatisticType.find_by!(key: 'hour', statistic_index_id: statistic_index_space.id).update!(label: nil, label_i18n_path: 'statistics.hours_number')
91+
StatisticType.find_by!(key: 'booking', statistic_index_id: statistic_index_space.id).update!(label: nil, label_i18n_path: 'statistics.bookings')
92+
StatisticType.find_by!(key: 'hour', statistic_index_id: statistic_index_space.id).update!(label: nil, label_i18n_path: 'statistics.hours_number')
9393

94-
StatisticType.find_by!(key: 'store', statistic_index_id: statistic_index_order.id).update!(label: nil, label_i18n_path: 'statistics.store')
94+
StatisticType.find_by!(key: 'store', statistic_index_id: statistic_index_order.id).update!(label: nil, label_i18n_path: 'statistics.store')
95+
end
9596
end
9697

9798
# StatisticSubType

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fab-manager",
3-
"version": "6.4.1",
3+
"version": "6.4.2",
44
"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.",
55
"keywords": [
66
"fablab",

0 commit comments

Comments
 (0)