Revision 687

Date:
2018/06/06 10:40:36
Author:
ahitrov
Revision Log:
Return all usable coupons but with flag "afflict_order"

Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/plugins/webshop/lib/webshop/Keeper.pm

     
    575 575 }
    576 576
    577 577 @groups = sort { $b->{discount} <=> $a->{discount} } @groups;
    578 my %chosen = map { $_->id => $_ } @{$groups[0]->{coupons}};
    579 foreach my $coupon ( @usable ) {
    580 if ( !exists $chosen{$coupon->id} ) {
    581 $coupon->{afflict_order} = 0;
    582 }
    583 }
    578 584 warn "We choose ".scalar(@{$groups[0]->{coupons}})." coupons: [".join(', ', map { $_->id.'. '.$_->name } @{$groups[0]->{coupons}})."]\n" if $DEBUG;
    579 return ($groups[0]->{discount}, $groups[0]->{coupons});
    585 return ($groups[0]->{discount}, \@usable);
    580 586 }
    581 587
    582 588