mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-30 21:27:17 +00:00
Adding a scope on subscription_line_item.rb to select records where price estimate is nil
This commit is contained in:
@@ -9,6 +9,7 @@ class SubscriptionLineItem < ApplicationRecord
|
||||
validates :quantity, presence: true, numericality: { only_integer: true }
|
||||
|
||||
default_scope { order('id ASC') }
|
||||
scope :nil_price_estimate, -> { where(price_estimate: nil) }
|
||||
|
||||
def total_estimate
|
||||
(price_estimate || 0) * (quantity || 0)
|
||||
|
||||
Reference in New Issue
Block a user