Commit cfe7b7d3 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

- Ajout d'une commande pour reconstruire tous les index

- Ajout d'option d'indexation étendue pour les activités et les projets
- Fix UI des Jalons (fiche activité)
- Fix Affichage de la personnes qui a réalisé/pris en charge un jalon
parent ae985c33
Loading
Loading
Loading
Loading
Loading
+45 −0
Original line number Diff line number Diff line
<?php


namespace Oscar\Command;


use Oscar\Service\NotificationService;
use Oscar\Service\OrganizationService;
use Oscar\Service\OscarUserContext;
use Oscar\Service\PersonService;
use Oscar\Service\ProjectGrantService;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

class OscarRebuildSearchCommand extends OscarCommandAbstract
{
    protected static $defaultName = 'rebuild:search';

    protected function configure()
    {
        $this
            ->setDescription("Recalcule les index de recherche");
    }

    protected function execute(InputInterface $input, OutputInterface $output) :int
    {
        $this->addOutputStyle($output);

        $persons = $this->getApplication()->find('persons:search-rebuild');
        $organizations = $this->getApplication()->find('organizations:search-rebuild');
        $projects = $this->getApplication()->find('project:search-rebuild');
        $activity = $this->getApplication()->find('activity:search-rebuild');

        $persons->run($input, $output);
        $organizations->run($input, $output);
        $projects->run($input, $output);
        $activity->run($input, $output);

        return self::SUCCESS;
    }
}
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ use Oscar\Entity\SpentTypeGroup;
use Oscar\Entity\TabDocument;
use Oscar\Entity\ValidationPeriod;
use Oscar\Entity\ValidationPeriodRepository;
use Oscar\Event\OscarEvent;
use Oscar\Exception\OscarException;
use Oscar\Factory\ActivityGantJson;
use Oscar\Form\ProjectGrantForm;
+9 −4
Original line number Diff line number Diff line
@@ -106,12 +106,13 @@ class GearmanJobLauncherService implements UseOscarConfigurationService, UseLogg
    /**
     * @param Project $project
     */
    public function triggerUpdateSearchIndexProject(Project $project): void
    public function triggerUpdateSearchIndexProject(Project $project, bool $andActivity = true): void
    {
        if( $andActivity ){
            foreach ($project->getActivities() as $activity) {
            $this->triggerUpdateSearchIndexActivity($activity);
                $this->triggerUpdateSearchIndexActivity($activity, false);
            }
        }
        error_log("INDEX PROJECT");
        $task = self::UPDATE_INDEX_PROJECT;
        $params = ['projectid' => $project->getId()];
        $key = sprintf('%s-%s', $task, $project->getId());
@@ -149,12 +150,16 @@ class GearmanJobLauncherService implements UseOscarConfigurationService, UseLogg
     *
     * @param Activity $activity
     */
    public function triggerUpdateSearchIndexActivity(Activity $activity): void
    public function triggerUpdateSearchIndexActivity(Activity $activity, bool $andProject = true): void
    {
        $task = self::UPDATE_INDEX_ACTIVITY;
        $params = ['activityid' => $activity->getId()];
        $key = sprintf('%s-%s', $task, $activity->getId());
        $this->getLoggerService()->info( " > gearman : $task($key) " . json_encode($params));
        $this->sendBackgroundTask($task, $params, $key);
        if( $activity->getProject() && $andProject ){
            $this->triggerUpdateSearchIndexProject($activity->getProject(), false);
        }
    }

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+1 −0
Original line number Diff line number Diff line
@@ -877,6 +877,7 @@ class ProjectGrantApiService implements
                'type' => $typesArr[$data->getType()->getId()],
                'type_id' => $data->getType()->getId(),
                'finished' => $data->getFinished(),
                'finishedBy' => $data->getFinishedBy(),
                'validable' => $data->getType()->isFinishable()
                //'hasProgression' => $data->getProgressInfo()
            ];
+0 −8
Original line number Diff line number Diff line
<?php

namespace Oscar\Strategy\Search;

class ActivityElasticSearch extends ElasticActivitySearch
{

}
 No newline at end of file
Loading