@@ -36,64 +36,70 @@ def change
36
36
37
37
# StatisticField
38
38
39
- StatisticField . find_by! ( key : 'groupName' , statistic_index_id : statistic_index_subscription . id ) . update! ( label : nil , label_i18n_path : 'statistics.group' )
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
41
41
- StatisticField . find_by! ( key : 'spaceDates' , statistic_index_id : statistic_index_space . id ) . update! ( label : nil , label_i18n_path : 'statistics.space_dates' )
42
- StatisticField . find_by! ( key : 'groupName' , statistic_index_id : statistic_index_space . id ) . update! ( label : nil , label_i18n_path : 'statistics.group' )
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
44
44
- StatisticField . find_by! ( key : 'machineDates' , statistic_index_id : statistic_index_machine . id ) . update! ( label : nil , label_i18n_path : 'statistics.machine_dates' )
45
- StatisticField . find_by! ( key : 'groupName' , statistic_index_id : statistic_index_machine . id ) . update! ( label : nil , label_i18n_path : 'statistics.group' )
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
47
47
48
48
- StatisticField . find_by! ( key : 'trainingId' , statistic_index_id : statistic_index_training . id ) . update! ( label : nil , label_i18n_path : 'statistics.training_id' )
49
- StatisticField . find_by! ( key : 'trainingDate' , statistic_index_id : statistic_index_training . id ) . update! ( label : nil , label_i18n_path : 'statistics.training_date' )
50
- StatisticField . find_by! ( key : 'groupName' , statistic_index_id : statistic_index_training . id ) . update! ( label : nil , label_i18n_path : 'statistics.group' )
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' )
51
52
52
- StatisticField . find_by! ( key : 'name' , statistic_index_id : statistic_index_event . id ) . update! ( label : nil , label_i18n_path : 'statistics.event_name' )
53
- StatisticField . find_by! ( key : 'eventId' , statistic_index_id : statistic_index_event . id ) . update! ( label : nil , label_i18n_path : 'statistics.event_id' )
54
- StatisticField . find_by! ( key : 'eventDate' , statistic_index_id : statistic_index_event . id ) . update! ( label : nil , label_i18n_path : 'statistics.event_date' )
55
- StatisticField . find_by! ( key : 'groupName' , statistic_index_id : statistic_index_event . id ) . update! ( label : nil , label_i18n_path : 'statistics.group' )
56
- StatisticField . find_by! ( key : 'eventTheme' , statistic_index_id : statistic_index_event . id ) . update! ( label : nil , label_i18n_path : 'statistics.event_theme' )
57
- StatisticField . find_by! ( key : 'ageRange' , statistic_index_id : statistic_index_event . id ) . update! ( label : nil , label_i18n_path : 'statistics.age_range' )
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' )
58
59
59
- StatisticField . find_by! ( key : 'groupName' , statistic_index_id : statistic_index_account . id ) . update! ( label : nil , label_i18n_path : 'statistics.group' )
60
+ StatisticField . find_by! ( key : 'groupName' , statistic_index_id : statistic_index_account . id ) . update! ( label : nil , label_i18n_path : 'statistics.group' )
60
61
61
- StatisticField . find_by! ( key : 'themes' , statistic_index_id : statistic_index_project . id ) . update! ( label : nil , label_i18n_path : 'statistics.themes' )
62
- StatisticField . find_by! ( key : 'components' , statistic_index_id : statistic_index_project . id ) . update! ( label : nil , label_i18n_path : 'statistics.components' )
63
- StatisticField . find_by! ( key : 'machines' , statistic_index_id : statistic_index_project . id ) . update! ( label : nil , label_i18n_path : 'statistics.machines' )
64
- StatisticField . find_by! ( key : 'status' , statistic_index_id : statistic_index_project . id ) . update! ( label : nil , label_i18n_path : 'statistics.project_status' )
65
- StatisticField . find_by! ( key : 'name' , statistic_index_id : statistic_index_project . id ) . update! ( label : nil , label_i18n_path : 'statistics.project_name' )
66
- StatisticField . find_by! ( key : 'projectUserNames' , statistic_index_id : statistic_index_project . id ) . update! ( label : nil , label_i18n_path : 'statistics.project_user_names' )
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' )
67
68
68
- StatisticField . find_by! ( key : 'userId' , statistic_index_id : statistic_index_user . id ) . update! ( label : nil , label_i18n_path : 'statistics.user_id' )
69
+ StatisticField . find_by! ( key : 'userId' , statistic_index_id : statistic_index_user . id ) . update! ( label : nil , label_i18n_path : 'statistics.user_id' )
69
70
70
- StatisticField . find_by! ( key : 'groupName' , statistic_index_id : statistic_index_order . id ) . update! ( label : nil , label_i18n_path : 'statistics.group' )
71
+ StatisticField . find_by! ( key : 'groupName' , statistic_index_id : statistic_index_order . id ) . update! ( label : nil , label_i18n_path : 'statistics.group' )
72
+ end
71
73
72
74
# StatisticType
73
- StatisticType . find_by! ( key : 'booking' , statistic_index_id : statistic_index_machine . id ) . update! ( label : nil , label_i18n_path : 'statistics.bookings' )
74
- StatisticType . find_by! ( key : 'hour' , statistic_index_id : statistic_index_machine . id ) . update! ( label : nil , label_i18n_path : 'statistics.hours_number' )
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' )
75
78
76
- StatisticType . find_by! ( key : 'booking' , statistic_index_id : statistic_index_training . id ) . update! ( label : nil , label_i18n_path : 'statistics.bookings' )
77
- 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' )
78
81
79
- StatisticType . find_by! ( key : 'booking' , statistic_index_id : statistic_index_event . id ) . update! ( label : nil , label_i18n_path : 'statistics.tickets_number' )
80
- 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' )
81
84
82
- 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' )
83
86
84
- 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' )
85
88
86
- 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' )
87
90
88
- StatisticType . find_by! ( key : 'booking' , statistic_index_id : statistic_index_space . id ) . update! ( label : nil , label_i18n_path : 'statistics.bookings' )
89
- 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' )
90
93
91
- 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
92
96
93
97
# StatisticSubType
94
- StatisticSubType . find_by! ( key : 'created' ) . update! ( label : nil , label_i18n_path : 'statistics.account_creation' )
95
- StatisticSubType . find_by! ( key : 'published' ) . update! ( label : nil , label_i18n_path : 'statistics.project_publication' )
96
- StatisticSubType . find_by! ( key : 'paid-processed' ) . update! ( label : nil , label_i18n_path : 'statistics.paid-rocessed' )
97
- StatisticSubType . find_by! ( key : 'aborted' ) . update! ( label : nil , label_i18n_path : 'statistics.aborted' )
98
+ if StatisticSubType . count > 0
99
+ StatisticSubType . find_by! ( key : 'created' ) . update! ( label : nil , label_i18n_path : 'statistics.account_creation' )
100
+ StatisticSubType . find_by! ( key : 'published' ) . update! ( label : nil , label_i18n_path : 'statistics.project_publication' )
101
+ StatisticSubType . find_by! ( key : 'paid-processed' ) . update! ( label : nil , label_i18n_path : 'statistics.paid-rocessed' )
102
+ StatisticSubType . find_by! ( key : 'aborted' ) . update! ( label : nil , label_i18n_path : 'statistics.aborted' )
103
+ end
98
104
end
99
105
end
0 commit comments