1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-28 09:24:24 +01:00

(bug) cannot run seed for create statistic index

This commit is contained in:
Du Peng 2022-10-18 17:29:32 +02:00
parent 6bdbe1fe50
commit 3fc232ad55

View File

@ -12,8 +12,7 @@ if StatisticIndex.count.zero?
{ id: 4, es_type_key: 'event', label: I18n.t('statistics.events') },
{ id: 5, es_type_key: 'account', label: I18n.t('statistics.registrations'), ca: false },
{ id: 6, es_type_key: 'project', label: I18n.t('statistics.projects'), ca: false },
{ id: 7, es_type_key: 'user', label: I18n.t('statistics.users'), table: false, ca: false },
{ id: 8, es_type_key: 'order', label: I18n.t('statistics.orders') }
{ id: 7, es_type_key: 'user', label: I18n.t('statistics.users'), table: false, ca: false }
])
connection = ActiveRecord::Base.connection
connection.execute("SELECT setval('statistic_indices_id_seq', 7);") if connection.instance_values['config'][:adapter] == 'postgresql'
@ -1034,10 +1033,7 @@ end
unless StatisticIndex.find_by(es_type_key: 'order')
index = StatisticIndex.create!(es_type_key: 'order', label: I18n.t('statistics.orders'))
type = StatisticType.create!([
{ statistic_index_id: index.id, key: 'store', label: I18n.t('statistics.store'),
graph: true, simple: true }
])
type = StatisticType.create!({ statistic_index_id: index.id, key: 'store', label: I18n.t('statistics.store'), graph: true, simple: true })
StatisticSubType.create!([
{ key: 'paid-processed', label: I18n.t('statistics.paid-processed'), statistic_types: [type] },
{ key: 'aborted', label: I18n.t('statistics.aborted'), statistic_types: [type] }