Skip to content

Commit

Permalink
fix(backend): fix statut in import
Browse files Browse the repository at this point in the history
  • Loading branch information
pYassine committed Jul 24, 2024
1 parent f070d49 commit aa5a80e
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ function buildUsager({
userId: user.id,
userName: agent,
},
statut: decision.statut,
decision,
lastInteraction: {
dateInteraction: dernierPassage,
Expand Down
28 changes: 25 additions & 3 deletions packages/backend/src/usagers/controllers/usagers.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ import pdftk = require("node-pdftk");
import { join, resolve } from "path";
import { readFile } from "fs-extra";
import { ExpressResponse } from "../../util/express";
import { Usager, ETAPE_DOCUMENTS, CerfaDocType } from "@domifa/common";
import {
Usager,
ETAPE_DOCUMENTS,
CerfaDocType,
UsagerDecision,
} from "@domifa/common";
import { UsagerHistoryStateService } from "../services/usagerHistoryState.service";
import { domifaConfig } from "../../config";
import { FileManagerService } from "../../util/file-manager/file-manager.service";
Expand Down Expand Up @@ -105,9 +110,26 @@ export class UsagersController {
},
});

const filterHistorique = (usager: Usager) => {
if (usager.historique && Array.isArray(usager.historique)) {
usager.historique = usager.historique.map((item: UsagerDecision) => ({
statut: item.statut,
dateDecision: item.dateDecision,
dateDebut: item.dateDebut,
dateFin: item.dateFin,
})) as UsagerDecision[];
}
return usager;
};

// Appliquer le filtre sur les deux ensembles d'usagers
const filteredUsagersNonRadies = usagersNonRadies.map(filterHistorique);
const filteredUsagersRadiesFirsts =
usagersRadiesFirsts.map(filterHistorique);

return {
usagersNonRadies,
usagersRadiesFirsts,
usagersNonRadies: filteredUsagersNonRadies,
usagersRadiesFirsts: filteredUsagersRadiesFirsts,
usagersRadiesTotalCount,
};
}
Expand Down
6 changes: 1 addition & 5 deletions packages/frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,7 @@ export class AppComponent implements OnInit, OnDestroy {

this.currentUrl = this.router.url;

this.authService.isAuth().subscribe({
next: () => {
console.log("");
},
});
this.authService.isAuth().subscribe();

this.authService.currentUserSubject.subscribe({
next: (user: UserStructure | null) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ <h1 class="col-md-2 col-12 title text-start order-1 order-md-1">
class="col-md-2 col-6"
[ngClass]="{ 'selected-section': filters.statut === 'REFUS' }"
[attr.aria-label]="
'Afficher les ' + allUsagersByStatus.REFUS.length + ' dossiers '
'Afficher les ' + allUsagersByStatus?.REFUS?.length + ' dossiers '
"
[attr.aria-selected]="filters.statut === 'REFUS'"
(click)="updateFilters({ element: 'statut', value: 'REFUS' })"
Expand All @@ -216,7 +216,7 @@ <h1 class="col-md-2 col-12 title text-start order-1 order-md-1">
class="col-md-2 col-6"
[ngClass]="{ 'selected-section': filters.statut === 'RADIE' }"
[attr.aria-label]="
'Afficher les ' + allUsagersByStatus.RADIE.length + ' dossiers '
'Afficher les ' + allUsagersByStatus?.RADIE?.length + ' dossiers '
"
[attr.aria-selected]="filters.statut === 'RADIE'"
(click)="updateFilters({ element: 'statut', value: 'RADIE' })"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class ManageUsagersPageComponent implements OnInit, OnDestroy {
this.usagers = [];
this.filters = new UsagersFilterCriteria(this.getFilters());

this.pageSize = 200;
this.pageSize = 50;
this.filters.page = 0;
this.titleService.setTitle("Gestion des domiciliés - DomiFa");
}
Expand Down Expand Up @@ -226,6 +226,7 @@ export class ManageUsagersPageComponent implements OnInit, OnDestroy {
private updateComponentState(
searchPageLoadedUsagersData: SearchPageLoadedUsagersData
) {
console.log(searchPageLoadedUsagersData.usagersRadiesTotalCount);
this.usagersRadiesTotalCount =
searchPageLoadedUsagersData.usagersRadiesTotalCount;
this.usagersTotalCount =
Expand Down

0 comments on commit aa5a80e

Please sign in to comment.