Browse Source

Merge branch 'develop'

master
Guillaume 2 years ago
parent
commit
b52bc25f7c
2 changed files with 10 additions and 6 deletions
  1. +2
    -2
      Builder/Order/OrderShopBuilder.php
  2. +8
    -4
      Statistic/Product/ProductsSalesStatistic.php

+ 2
- 2
Builder/Order/OrderShopBuilder.php View File

@@ -671,8 +671,8 @@ class OrderShopBuilder
$this->productSolver
);

$productsSalesStatistic->init($section, $this->distributionBuilder, $this->openingResolver);
$productsSalesStatistic->populateProperties($this->orderShopStore);
$productsSalesStatistic->init($section, $this->distributionBuilder);
$productsSalesStatistic->populateProperties($this->orderShopStore->resetContext()->setSection($section));

return $productsSalesStatistic->getAsArray();
}

+ 8
- 4
Statistic/Product/ProductsSalesStatistic.php View File

@@ -2,6 +2,7 @@

namespace Lc\CaracoleBundle\Statistic\Product;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Builder\Distribution\DistributionBuilder;
use Lc\CaracoleBundle\Container\Order\OrderShopContainer;
@@ -56,11 +57,14 @@ class ProductsSalesStatistic extends Statistic
// Initialise les valeurs des données pour chaque Interval de date
public function init(SectionInterface $section, DistributionBuilder $distributionBuilder)
{
$this->distributionList = $distributionBuilder->getDistributionListFromCurrentOrder($section, $this->nbCycle);
$distributionArray = $distributionBuilder->getDistributionListFromCurrentOrder($section, $this->nbCycle);
$this->distributionList = $distributionArray->toArray();

// if ($openingResolver->isOpenSale($section, null,OpeningResolver::OPENING_CONTEXT_BACKEND) == false && date('w') > 2) {
// $currentCycleNumber = $currentCycleNumber - 1;
// }
// @TODO : à retravailler pour inclure cette logique directement dans getDistributionListFromCurrentOrder()
$distributionCurrentOrder = $distributionBuilder->guessCurrentDistributionOrder($section);
if(!$distributionArray->contains($distributionCurrentOrder)) {
array_unshift($this->distributionList, $distributionCurrentOrder);
}

foreach ($this->distributionList as $distribution){
$this->labels[$this->getKey($distribution->getCycleNumber(),$distribution->getYear())] = $distribution->getCycleNumber();

Loading…
Cancel
Save