mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
[bug] news plans statistics are not shown
This commit is contained in:
parent
21560dd5d9
commit
f4187d0b4b
@ -13,9 +13,11 @@
|
||||
- Fix a bug: unable to delete an event with a linked custom price (#61)
|
||||
- Fix a bug: navigation in client calendar is bogus when browsing months (#59)
|
||||
- Fix a bug: subscription name is not shown in invoices
|
||||
- Fix a bug: news plans statistics are not shown
|
||||
- [TODO DEPLOY] `rake db:migrate`, then `rake db:seed`
|
||||
- [TODO DEPLOY] add the `FABLAB_WITHOUT_SPACES` environment variable
|
||||
- [TODO DEPLOY] `rake fablab:es_add_spaces`
|
||||
- [TODO DEPLOY] `rake fablab:fix:new_plans_statistics` if you have created plans from v2.4.10
|
||||
|
||||
## v2.4.11 2017 March 15
|
||||
- Fix a bug: editing and saving a plan, result in removing the rolling attribute
|
||||
|
@ -11,7 +11,7 @@ class Plan < ActiveRecord::Base
|
||||
has_many :prices, dependent: :destroy
|
||||
|
||||
extend FriendlyId
|
||||
friendly_id :name, use: :slugged
|
||||
friendly_id :base_name, use: :slugged
|
||||
|
||||
accepts_nested_attributes_for :prices
|
||||
accepts_nested_attributes_for :plan_file, allow_destroy: true, reject_if: :all_blank
|
||||
@ -28,6 +28,7 @@ class Plan < ActiveRecord::Base
|
||||
validates :amount, :group, :base_name, presence: true
|
||||
validates :interval_count, numericality: { only_integer: true, greater_than_or_equal_to: 1 }
|
||||
validates :interval, inclusion: { in: %w(year month) }
|
||||
validates :base_name, :slug, presence: true
|
||||
|
||||
def self.create_for_all_groups(plan_params)
|
||||
plans = []
|
||||
|
@ -25,5 +25,15 @@ namespace :fablab do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
task new_plans_statistics: :environment do
|
||||
StatisticSubType.where(key: nil).each do |sst|
|
||||
p = Plan.find_by(name: sst.label)
|
||||
if p
|
||||
sst.key = p.slug
|
||||
sst.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user