diff --git a/changelog.md b/changelog.md index 377aaaf..cd48baf 100644 --- a/changelog.md +++ b/changelog.md @@ -2,13 +2,14 @@ This file describe all changes of each updates on the website ## Release dates -| Date | Number | Type | Version | -|-----------:|-------:|:--------|:----------------------------| -| 2021-03-31 | 1 | Release | [v1.0.0](###Release-v1.0.0) | -| 2021-03-31 | 2 | Hotfix | [v1.0.1](###Hotfix-v1.0.1) | -| 2021-03-31 | 3 | Hotfix | [v1.0.2](###Hotfix-v1.0.2) | -| 2021-04-06 | 4 | Release | [v1.0.3](###Release-v1.0.3) | -| 2021-04-13 | 5 | Release | [v1.0.3](###Release-v1.0.4) | +| Date | Number | Type | Version | +|-----------:|-------:|:--------|:--------------------------| +| 2021-03-31 | 1 | Release | [v1.0.0](#Release-v1.0.0) | +| 2021-03-31 | 2 | Hotfix | [v1.0.1](#Hotfix-v1.0.1) | +| 2021-03-31 | 3 | Hotfix | [v1.0.2](#Hotfix-v1.0.2) | +| 2021-04-06 | 4 | Release | [v1.0.3](#Release-v1.0.3) | +| 2021-04-13 | 5 | Release | [v1.0.4](#Release-v1.0.4) | +| 2021-04-16 | 6 | Release | [v1.0.4](#Release-v1.0.5) | ## Changes ### Release v1.0.0 @@ -42,4 +43,15 @@ #### Fix - Cache clear in update.bat -- Cache clear in README \ No newline at end of file +- Cache clear in README + +### Release v1.0.5 +#### Feature +- Add licencing + +#### Improve +- Add unassigned filter to activities + +#### Fix +- Doctrine deprecation +- Activity filter does not shows unassigned activities \ No newline at end of file diff --git a/composer.lock b/composer.lock index 935b7d0..8c169a3 100644 --- a/composer.lock +++ b/composer.lock @@ -1508,16 +1508,16 @@ }, { "name": "laminas/laminas-code", - "version": "4.1.0", + "version": "4.2.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-code.git", - "reference": "5b553c274b94af3f880cbaaf8fbab047f279a31c" + "reference": "e7e8f8a9c267520051d8026ff1da74823a3d8b97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-code/zipball/5b553c274b94af3f880cbaaf8fbab047f279a31c", - "reference": "5b553c274b94af3f880cbaaf8fbab047f279a31c", + "url": "https://api.github.com/repos/laminas/laminas-code/zipball/e7e8f8a9c267520051d8026ff1da74823a3d8b97", + "reference": "e7e8f8a9c267520051d8026ff1da74823a3d8b97", "shasum": "" }, "require": { @@ -1575,7 +1575,7 @@ "type": "community_bridge" } ], - "time": "2021-03-27T13:55:31+00:00" + "time": "2021-04-14T22:05:06+00:00" }, { "name": "laminas/laminas-eventmanager", diff --git a/config/packages/doctrine.yaml b/config/packages/doctrine.yaml index 67193cb..aac1b60 100644 --- a/config/packages/doctrine.yaml +++ b/config/packages/doctrine.yaml @@ -6,7 +6,7 @@ default_table_options: charset: utf8mb4 collate: utf8mb4_unicode_ci - + override_url: true url: '%env(resolve:DATABASE_URL)%' orm: default_entity_manager: default diff --git a/licence.txt b/licence.txt new file mode 100644 index 0000000..dc49fde --- /dev/null +++ b/licence.txt @@ -0,0 +1,7 @@ +Copyright 2021 Kilian Riou + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/src/Controller/AbstractExtendedController.php b/src/Controller/AbstractExtendedController.php index 0dd4f1d..74710a4 100644 --- a/src/Controller/AbstractExtendedController.php +++ b/src/Controller/AbstractExtendedController.php @@ -7,6 +7,7 @@ use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Stopwatch\Stopwatch; /** * Abstract class for generic controller @@ -14,6 +15,14 @@ abstract class AbstractExtendedController extends AbstractController { + /** @var Stopwatch Profiler stopwatch */ + protected $stopwatch = null; + + public function __construct(Stopwatch $stopwatch) + { + $this->stopwatch = $stopwatch; + } + /** * Create the json answer for an ajax form * - code : Http code @@ -49,9 +58,11 @@ */ protected function createNamedCustomForm(string $name, string $type, array $options = []): AbstractFormManager { + $this->stopwatch->start($name, 'form'); /** @var FormFactory $formFactory */ $formFactory = $this->container->get('form.factory'); $formBuilder = $formFactory->createNamedBuilder($name, FormType::class); + $this->stopwatch->stop($name); return new $type($formBuilder, $options, true); } @@ -65,12 +76,14 @@ */ protected function createNamedGetCustomForm(string $name, string $type, array $options = []): AbstractFormManager { + $this->stopwatch->start($name, 'form'); /** @var FormFactory $formFactory */ $formFactory = $this->container->get('form.factory'); $formBuilder = $formFactory->createNamedBuilder($name, FormType::class, [], [ 'csrf_protection' => false, ]); $formBuilder->setMethod('GET'); + $this->stopwatch->stop($name); return new $type($formBuilder, $options, false); } } diff --git a/src/Form/Activity/ActivityFilterForm.php b/src/Form/Activity/ActivityFilterForm.php index 17d7efe..ebf6f46 100644 --- a/src/Form/Activity/ActivityFilterForm.php +++ b/src/Form/Activity/ActivityFilterForm.php @@ -31,6 +31,7 @@ $this->actors = $data['actors']; $formBuilder->setData([ 'actor' => null, + 'unassigned' => false, 'followed' => false, 'status' => null, @@ -53,17 +54,25 @@ { $data = $this->getData(); + // Create query + $query = $activityRepository->createQueryBuilder('activity'); + // Create filter $criteria = new Criteria(); // Filter actors + if ($data['followed']) { + $query->join(ActorEntity::class, 'actor', Join::WITH, 'activity.actor = actor'); + $criteria->andWhere($criteria->expr() + ->eq('actor.followed', true)); + } if (!is_null($data['actor'])) { $criteria->andWhere($criteria->expr() ->eq('activity.actor', $data['actor'])); } - if ($data['followed']) { + if ($data['unassigned']) { $criteria->andWhere($criteria->expr() - ->eq('actor.followed', true)); + ->isNull('activity.actor')); } // Filter status @@ -90,13 +99,10 @@ if (!is_null($data['startBefore'])) { $criteria->andWhere($criteria->expr() ->orX($criteria->expr() - ->isNull('activity.realStartDate'), $criteria->expr() - ->lt('activity.realStartDate', $data['startBefore']))); + ->isNull('activity.realStartDate'), $criteria->expr() + ->lt('activity.realStartDate', $data['startBefore']))); } - // Create query - $query = $activityRepository->createQueryBuilder('activity'); - $query->join(ActorEntity::class, 'actor', Join::WITH, 'activity.actor = actor'); $query->addCriteria($criteria); return $query->getQuery()->execute([], Query::HYDRATE_OBJECT); @@ -132,6 +138,9 @@ 'choice_label' => 'displayName', 'required' => false, ]) + ->add('unassigned', CheckboxType::class, [ + 'required' => false, + ]) ->add('followed', CheckboxType::class, [ 'required' => false, ]); diff --git a/templates/_includes/html/form/activity/filter.html.twig b/templates/_includes/html/form/activity/filter.html.twig index 37e9dc9..f3d3e1f 100644 --- a/templates/_includes/html/form/activity/filter.html.twig +++ b/templates/_includes/html/form/activity/filter.html.twig @@ -6,8 +6,12 @@ {{ form_widget(form.actor, {attr: {class: 'w-100'}}) }}
+ {{ form_widget(form.unassigned) }} + {{ form_label(form.unassigned, 'Non assigné') }} +
+
{{ form_widget(form.followed) }} - {{ form_label(form.followed, 'Acteurs suivis') }} + {{ form_label(form.followed, 'Acteur suivi') }}
@@ -17,7 +21,7 @@
{{ form_widget(form.active) }} - {{ form_label(form.active, 'Actifs') }} + {{ form_label(form.active, 'Actif') }}
{{ form_widget(form.notClosed) }}