Skip to content

Commit b45c6ec

Browse files
committed
Merge branch 'develop'
2 parents 5ab80b0 + 9511d51 commit b45c6ec

6 files changed

Lines changed: 27 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ See [keep a changelog] for information about writing changes to this log.
88

99
## [Unreleased]
1010

11+
## [3.1.0] - 2026-04-13
12+
13+
* [PR-39](https://github.com/itk-dev/sysstatus/pull/39)
14+
Prevented duplicating inactive reports and systems
1115
* [PR-38](https://github.com/itk-dev/sysstatus/pull/38)
1216
* Update importers
1317
* Add example data
@@ -177,7 +181,8 @@ See [keep a changelog] for information about writing changes to this log.
177181

178182
[keep a changelog]: https://keepachangelog.com/en/1.1.0/
179183

180-
[Unreleased]: https://github.com/itk-dev/sysstatus/compare/main...develop
184+
[Unreleased]: https://github.com/itk-dev/sysstatus/compare/3.1.0...HEAD
185+
[3.1.0]: https://github.com/itk-dev/sysstatus/compare/3.0.2...3.1.0
181186
[3.0.2]: https://github.com/itk-dev/sysstatus/releases/tag/3.0.2
182187
[3.0.1]: https://github.com/itk-dev/sysstatus/releases/tag/3.0.1
183188
[3.0.0]: https://github.com/itk-dev/sysstatus/releases/tag/3.0.0

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ Make sure you have a set of JSON files for testing import Commands.
2929
### Start Docker containers
3030

3131
```shell
32-
docker compose up -d
32+
docker compose up --detach
3333
docker compose exec phpfpm composer install
3434
docker compose exec phpfpm bin/console doctrine:migrations:migrate --no-interaction
3535
```
3636

3737
### Create a super admin user
3838

3939
```sh
40-
docker compose exec phpfpm bin/console SuperUser
40+
docker compose exec phpfpm bin/console app:user:create admin@example.com --password password --role=ROLE_SUPER_ADMIN
4141
```
4242

4343
### Access the site
@@ -88,7 +88,7 @@ flowchart TD
8888
Theme[Theme]
8989
ThemeCategory[ThemeCategory]
9090
User[User]
91-
91+
9292
fos_user_user_group{{JoinTable: fos_user_user_group }}
9393
group_system_themes{{JoinTable: group_system_themes }}
9494
group_report_themes{{JoinTable: group_report_themes }}
@@ -111,7 +111,7 @@ flowchart TD
111111
System --- |ManyToMany| SelServiceAFI
112112
113113
Theme --- |ManyToOne| ThemeCategory
114-
114+
115115
Answers --- |ManyToOne| Question
116116
Question -- JoinCollum Answers and Question --o Answers
117117

Taskfile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dotenv: ['.env.local', '.env']
55

66
vars:
77
# https://taskfile.dev/reference/templating/
8-
BASE_URL: '{{.TASK_BASE_URL | default .COMPOSE_SERVER_DOMAIN | default .COMPOSE_DOMAIN | default "https://hoeringsportal.local.itkdev.dk"}}'
8+
BASE_URL: '{{.TASK_BASE_URL | default .COMPOSE_SERVER_DOMAIN | default .COMPOSE_DOMAIN | default "https://itstyr.local.itkdev.dk"}}'
99
DOCKER_COMPOSE: '{{.TASK_DOCKER_COMPOSE | default "docker compose"}}'
1010

1111
tasks:

src/Service/BaseImporter.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use App\Repository\ReportRepository;
77
use App\Repository\SystemRepository;
88
use Doctrine\ORM\EntityManagerInterface;
9+
use Symfony\Component\Console\Helper\ProgressBar;
910
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
1011

1112
abstract class BaseImporter implements ImportInterface
@@ -22,6 +23,16 @@ public function __construct(
2223
$this->url = $this->params->get('system_url') ?? '';
2324
}
2425

26+
public function import(string $src, ?ProgressBar $progressBar = null): void
27+
{
28+
// We need to be able to find all entities during import.
29+
$this->entityManager->getFilters()->disable('entity_active');
30+
31+
$this->doImport($src, $progressBar);
32+
}
33+
34+
abstract protected function doImport(string $src, ?ProgressBar $progressBar): void;
35+
2536
protected function sanitizeText(string $str): ?string
2637
{
2738
$str = strip_tags($str, '<p><div><strong><a><ul><li><span><br><br/>');
@@ -63,9 +74,9 @@ protected function convertLink(?object $obj): ?string
6374
/**
6475
* @throws \Exception
6576
*/
66-
protected function convertDate(string $date): \DateTime
77+
protected function convertDate(string $date): ?\DateTimeInterface
6778
{
68-
return new \DateTime($date);
79+
return empty($date) ? null : new \DateTimeImmutable($date);
6980
}
7081

7182
/**
@@ -76,7 +87,7 @@ protected function convertDate(string $date): \DateTime
7687
protected function convertSystemOwner(array $systemOwner): string
7788
{
7889
if (empty($systemOwner)) {
79-
return '';
90+
return '';
8091
}
8192

8293
return $systemOwner[0]->LookupValue ?? '';

src/Service/ReportImporter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class ReportImporter extends BaseImporter
99
{
10-
public function import(string $src, ?ProgressBar $progressBar = null): void
10+
public function doImport(string $src, ?ProgressBar $progressBar = null): void
1111
{
1212
$json = file_get_contents($src);
1313
$entries = json_decode($json);

src/Service/SystemImporter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __construct(
2424
parent::__construct($reportRepository, $systemRepository, $groupRepository, $entityManager, $params);
2525
}
2626

27-
public function import(string $src, ?ProgressBar $progressBar = null): void
27+
public function doImport(string $src, ?ProgressBar $progressBar = null): void
2828
{
2929
$json = file_get_contents($src);
3030
$entries = json_decode($json);

0 commit comments

Comments
 (0)