mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-21 15:54:22 +01:00
(bug) unable to update a training's title
This commit is contained in:
parent
1205cb925c
commit
95a5a18600
@ -6,6 +6,7 @@
|
|||||||
- Improved public calendar loading time
|
- Improved public calendar loading time
|
||||||
- Fix a bug: event image updates are not reflected unless the browser's cache is purged
|
- Fix a bug: event image updates are not reflected unless the browser's cache is purged
|
||||||
- Fix a bug: schedules jobs are not launched at the right time
|
- Fix a bug: schedules jobs are not launched at the right time
|
||||||
|
- Fix a bug: unable to update the title of a training
|
||||||
- [TODO DEPLOY] `rails fablab:fix_availabilities` THEN `rails fablab:setup:build_places_cache`
|
- [TODO DEPLOY] `rails fablab:fix_availabilities` THEN `rails fablab:setup:build_places_cache`
|
||||||
- [TODO DEPLOY] `\curl -sSL https://raw.githubusercontent.com/sleede/fab-manager/master/scripts/rename-supporting-document.sh | bash`
|
- [TODO DEPLOY] `\curl -sSL https://raw.githubusercontent.com/sleede/fab-manager/master/scripts/rename-supporting-document.sh | bash`
|
||||||
|
|
||||||
|
@ -98,11 +98,11 @@ class Plan < ApplicationRecord
|
|||||||
|
|
||||||
# must be publicly accessible for the migration
|
# must be publicly accessible for the migration
|
||||||
def create_statistic_type
|
def create_statistic_type
|
||||||
stat_index = StatisticIndex.where(es_type_key: 'subscription')
|
stat_index = StatisticIndex.find_by(es_type_key: 'subscription')
|
||||||
type = find_statistic_type
|
type = find_statistic_type
|
||||||
if type.nil?
|
if type.nil?
|
||||||
type = StatisticType.create!(
|
type = StatisticType.create!(
|
||||||
statistic_index_id: stat_index.first.id,
|
statistic_index_id: stat_index.id,
|
||||||
key: duration.to_i,
|
key: duration.to_i,
|
||||||
label: "#{I18n.t('statistics.duration')} : #{human_readable_duration}",
|
label: "#{I18n.t('statistics.duration')} : #{human_readable_duration}",
|
||||||
graph: true,
|
graph: true,
|
||||||
@ -114,11 +114,11 @@ class Plan < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def find_statistic_type
|
def find_statistic_type
|
||||||
stat_index = StatisticIndex.where(es_type_key: 'subscription')
|
stat_index = StatisticIndex.find_by(es_type_key: 'subscription')
|
||||||
type = StatisticType.find_by(statistic_index_id: stat_index.first.id, key: duration.to_i)
|
type = StatisticType.find_by(statistic_index_id: stat_index.id, key: duration.to_i)
|
||||||
return type if type
|
return type if type
|
||||||
|
|
||||||
StatisticType.where(statistic_index_id: stat_index.first.id).where('label LIKE ?', "%#{human_readable_duration}%").first
|
StatisticType.where(statistic_index_id: stat_index.id).where('label LIKE ?', "%#{human_readable_duration}%").first
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -52,9 +52,9 @@ class Training < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_statistic_subtype
|
def update_statistic_subtype
|
||||||
index = StatisticIndex.where(es_type_key: 'training')
|
index = StatisticIndex.find_by(es_type_key: 'training')
|
||||||
subtype = StatisticSubType.joins(statistic_type_sub_types: :statistic_type)
|
subtype = StatisticSubType.joins(statistic_type_sub_types: :statistic_type)
|
||||||
.find_by(key: slug, statistic_types: { statistic_index_id: index.id })
|
.find_by!(key: slug, statistic_types: { statistic_index_id: index.id })
|
||||||
subtype.update(label: name)
|
subtype.update(label: name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user