mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-26 20:54:21 +01:00
(bug) prepaid-packs purchases are reported as subscriptions in the statistics
This commit is contained in:
parent
523311101a
commit
51a2bed16c
@ -14,6 +14,7 @@
|
|||||||
- Removed dependency to auto-ngtemplate-loader
|
- Removed dependency to auto-ngtemplate-loader
|
||||||
- Removed support for Universal Analytics
|
- Removed support for Universal Analytics
|
||||||
- Updated deprecated division operators in sass
|
- Updated deprecated division operators in sass
|
||||||
|
- Fix a bug: prepaid-packs purchases are reported as subscriptions in the statistics
|
||||||
- Fix a bug: error Couldn't find the binary git during assets compilation
|
- Fix a bug: error Couldn't find the binary git during assets compilation
|
||||||
- Fix a bug: a sentence was not linked to a translation key
|
- Fix a bug: a sentence was not linked to a translation key
|
||||||
- Fix a bug: the version check may be scheduled at an invalid time
|
- Fix a bug: the version check may be scheduled at an invalid time
|
||||||
@ -30,6 +31,7 @@
|
|||||||
- Fix a security issue: updated puma to 4.3.11 to fix [CVE-2022-23634](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23634)
|
- Fix a security issue: updated puma to 4.3.11 to fix [CVE-2022-23634](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23634)
|
||||||
- Fix a security issue: updated i18next-http-backend to 1.3.2 to fix [CVE-2022-0235](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-0235)
|
- Fix a security issue: updated i18next-http-backend to 1.3.2 to fix [CVE-2022-0235](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-0235)
|
||||||
- Fix a security issue: updated follow-redirects to 1.18.8 to fix [CVE-2022-0536](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-0536)
|
- Fix a security issue: updated follow-redirects to 1.18.8 to fix [CVE-2022-0536](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-0536)
|
||||||
|
- [TODO DEPLOY] `rails fablab:maintenance:regenerate_statistics[2021,07]`
|
||||||
- [TODO DEPLOY] `\curl -sSL https://raw.githubusercontent.com/sleede/fab-manager/master/scripts/cve-2021-44228.sh | bash`
|
- [TODO DEPLOY] `\curl -sSL https://raw.githubusercontent.com/sleede/fab-manager/master/scripts/cve-2021-44228.sh | bash`
|
||||||
- [TODO DEPLOY] migrate your Google Analytics property to GA4, see [this guide](https://support.google.com/analytics/answer/9744165)
|
- [TODO DEPLOY] migrate your Google Analytics property to GA4, see [this guide](https://support.google.com/analytics/answer/9744165)
|
||||||
- [TODO DEPLOY] update your tracking ID in Customization > Privacy > Statistics > Google Analytics
|
- [TODO DEPLOY] update your tracking ID in Customization > Privacy > Statistics > Google Analytics
|
||||||
|
@ -8,11 +8,6 @@ class InvoiceItem < Footprintable
|
|||||||
has_one :payment_gateway_object, as: :item
|
has_one :payment_gateway_object, as: :item
|
||||||
|
|
||||||
belongs_to :object, polymorphic: true
|
belongs_to :object, polymorphic: true
|
||||||
belongs_to :reservation, foreign_type: 'Reservation', foreign_key: 'object_id'
|
|
||||||
belongs_to :subscription, foreign_type: 'Subscription', foreign_key: 'object_id'
|
|
||||||
belongs_to :wallet_transaction, foreign_type: 'WalletTransaction', foreign_key: 'object_id'
|
|
||||||
belongs_to :offer_day, foreign_type: 'OfferDay', foreign_key: 'object_id'
|
|
||||||
belongs_to :statistic_profile_prepaid_pack, foreign_type: 'StatisticProfilePrepaidPack', foreign_key: 'object_id'
|
|
||||||
|
|
||||||
after_create :chain_record
|
after_create :chain_record
|
||||||
after_update :log_changes
|
after_update :log_changes
|
||||||
|
@ -97,9 +97,9 @@ class PDF::Invoice < Prawn::Document
|
|||||||
DATE: I18n.l(invoice.main_item.object.slots[0].start_at.to_date),
|
DATE: I18n.l(invoice.main_item.object.slots[0].start_at.to_date),
|
||||||
TIME: I18n.l(invoice.main_item.object.slots[0].start_at, format: :hour_minute))
|
TIME: I18n.l(invoice.main_item.object.slots[0].start_at, format: :hour_minute))
|
||||||
invoice.invoice_items.each do |item|
|
invoice.invoice_items.each do |item|
|
||||||
next unless item.subscription
|
next unless item.object_type == Subscription.name
|
||||||
|
|
||||||
subscription = item.subscription
|
subscription = item.object
|
||||||
cancellation = invoice.is_a?(Avoir) ? I18n.t('invoices.cancellation') + ' - ' : ''
|
cancellation = invoice.is_a?(Avoir) ? I18n.t('invoices.cancellation') + ' - ' : ''
|
||||||
object = "\n- #{object}\n- #{cancellation + subscription_verbose(subscription, name)}"
|
object = "\n- #{object}\n- #{cancellation + subscription_verbose(subscription, name)}"
|
||||||
break
|
break
|
||||||
@ -135,7 +135,7 @@ class PDF::Invoice < Prawn::Document
|
|||||||
details = invoice.is_a?(Avoir) ? I18n.t('invoices.cancellation') + ' - ' : ''
|
details = invoice.is_a?(Avoir) ? I18n.t('invoices.cancellation') + ' - ' : ''
|
||||||
|
|
||||||
if item.object_type == Subscription.name
|
if item.object_type == Subscription.name
|
||||||
subscription = item.subscription
|
subscription = item.object
|
||||||
if invoice.main_item.object_type == 'OfferDay'
|
if invoice.main_item.object_type == 'OfferDay'
|
||||||
details += I18n.t('invoices.subscription_extended_for_free_from_START_to_END',
|
details += I18n.t('invoices.subscription_extended_for_free_from_START_to_END',
|
||||||
START: I18n.l(invoice.main_item.object.start_at.to_date),
|
START: I18n.l(invoice.main_item.object.start_at.to_date),
|
||||||
|
@ -129,10 +129,13 @@ class StatisticService
|
|||||||
InvoiceItem.where('invoice_items.created_at >= :start_date AND invoice_items.created_at <= :end_date', options)
|
InvoiceItem.where('invoice_items.created_at >= :start_date AND invoice_items.created_at <= :end_date', options)
|
||||||
.eager_load(invoice: [:coupon], subscription: [:plan, statistic_profile: [:group]]).each do |i|
|
.eager_load(invoice: [:coupon], subscription: [:plan, statistic_profile: [:group]]).each do |i|
|
||||||
next if i.invoice.is_a?(Avoir)
|
next if i.invoice.is_a?(Avoir)
|
||||||
|
next unless i.invoice_item_type == Subscription.name
|
||||||
|
|
||||||
sub = i.subscription
|
sub = if i.object_type == Subscription.name
|
||||||
|
i.object
|
||||||
next unless sub
|
else
|
||||||
|
i.object.subscription
|
||||||
|
end
|
||||||
|
|
||||||
ca = i.amount.to_i
|
ca = i.amount.to_i
|
||||||
cs = CouponService.new
|
cs = CouponService.new
|
||||||
|
@ -499,7 +499,7 @@ class Reservations::CreateAsAdminTest < ActionDispatch::IntegrationTest
|
|||||||
# invoice_items
|
# invoice_items
|
||||||
invoice_items = InvoiceItem.last(2)
|
invoice_items = InvoiceItem.last(2)
|
||||||
|
|
||||||
assert(invoice_items.any? { |ii| ii.amount == plan.amount && !ii.subscription.nil? })
|
assert(invoice_items.any? { |ii| ii.amount == plan.amount && ii.object_type == Subscription.name })
|
||||||
assert(invoice_items.any? { |ii| ii.amount.zero? })
|
assert(invoice_items.any? { |ii| ii.amount.zero? })
|
||||||
|
|
||||||
# invoice assertions
|
# invoice assertions
|
||||||
|
@ -622,7 +622,7 @@ class Reservations::CreateTest < ActionDispatch::IntegrationTest
|
|||||||
|
|
||||||
assert_not_nil subscription_item
|
assert_not_nil subscription_item
|
||||||
|
|
||||||
subscription = subscription_item.subscription
|
subscription = subscription_item.object
|
||||||
|
|
||||||
assert_equal subscription_item.amount, plan.amount
|
assert_equal subscription_item.amount, plan.amount
|
||||||
assert_equal subscription.plan_id, plan.id
|
assert_equal subscription.plan_id, plan.id
|
||||||
|
Loading…
x
Reference in New Issue
Block a user