From ab719aed946b050dc2df230fb31fa7b6eda14845 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Tue, 30 Jan 2018 10:59:07 +0100 Subject: [PATCH] =?utf8?q?PriceSource:=20fast=20Flag=20f=C3=BCr=20zuk?= =?utf8?q?=C3=BCnftige=20Performanceoptimierungen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/PriceSource.pm | 15 +++++++++++++-- SL/PriceSource/Base.pm | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/SL/PriceSource.pm b/SL/PriceSource.pm index 6fd3cbcee..05168ce67 100644 --- a/SL/PriceSource.pm +++ b/SL/PriceSource.pm @@ -3,7 +3,7 @@ package SL::PriceSource; use strict; use parent 'SL::DB::Object'; use Rose::Object::MakeMethods::Generic ( - scalar => [ qw(record_item record) ], + scalar => [ qw(record_item record fast) ], 'scalar --get_set_init' => [ qw( best_price best_discount ) ], @@ -31,7 +31,7 @@ sub price_source_by_class { return unless $class; $self->{price_source_by_name}{$class} //= - $class->new(record_item => $self->record_item, record => $self->record); + $class->new(record_item => $self->record_item, record => $self->record, fast => $self->fast); } sub price_from_source { @@ -253,8 +253,19 @@ opens the price field to manual changes. A special empty discount that does not change the previously entered discount and opens the discount field to manual changes. +=item C + +If set to true, indicates that calls may skip doing intensive work and instead +return a price or discount flagged as unknown. The caller must be prepared to +deal with those. + +Typically this is intended to delay expensive calculations until they can be +done in a second batch pass. If the information is already present, it is still +encouraged that implementations return the correct values. + =back + =head1 SEE ALSO L, diff --git a/SL/PriceSource/Base.pm b/SL/PriceSource/Base.pm index 9382f108f..8cc388807 100644 --- a/SL/PriceSource/Base.pm +++ b/SL/PriceSource/Base.pm @@ -4,7 +4,7 @@ use strict; use parent qw(SL::DB::Object); use Rose::Object::MakeMethods::Generic ( - scalar => [ qw(record_item record) ], + scalar => [ qw(record_item record fast) ], ); sub name { die 'name needs to be implemented' } -- 2.20.1