Skip to content

Commit

Permalink
fix: workforce on index consultation search (#2107)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonat75 authored Feb 6, 2024
1 parent 1b42536 commit 87982e4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export interface CompanyProps {
range?: CompanyWorkforceRange;
region?: Region;
siren: Siren;
/** Total effectif */
total?: PositiveNumber;
ues?: UES;
workforce?: { range: CompanyWorkforceRange; total: PositiveNumber };
}

export class Company extends JsonEntity<CompanyProps, never> {
Expand Down Expand Up @@ -122,8 +122,13 @@ export class Company extends JsonEntity<CompanyProps, never> {
props.ues = UES.fromJson(json.ues);
}

if (typeof json.total === "number") {
props.total = new PositiveNumber(json.total);
if (json.workforce) {
props.total = new PositiveNumber(json.workforce.total);
props.range = new CompanyWorkforceRange(json.workforce.range);
props.workforce = {
range: new CompanyWorkforceRange(json.workforce.range),
total: new PositiveNumber(json.workforce.total),
};
}

if (json.range) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ export const declarationSearchResultMap: Mapper<
}
: void 0,
workforce: {
range: value.entreprise.effectif?.tranche,
total: value.entreprise.effectif?.total,
range: value.entreprise.effectif?.tranche ?? "50:250",
total: value.entreprise.effectif?.total ?? 0,
},
nafCode: value.entreprise.code_naf,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const TileCompanyIndex = (dto: SearchDeclarationResultDTO) => {
</GridCol>
<GridCol sm={3}>
<div className={fr.cx("fr-mt-1v", "fr-mt-md-0")}>
<span className={styles.numberOfEmployees}>{mapRange(workforce?.range)}</span>
<span className={styles.numberOfEmployees}>{workforce?.total}</span>
<span className={styles.employeeslegend}>{` Salariés${
workforce?.range === CompanyWorkforceRange.Enum.FROM_1000_TO_MORE ? " ou plus" : ""
}`}</span>
Expand Down Expand Up @@ -177,7 +177,7 @@ export const TileCompanyIndex = (dto: SearchDeclarationResultDTO) => {
</li>
<li>
Écart taux d'augmentation :{" "}
{company[row.year].workforce?.range === CompanyWorkforceRange.Enum.FROM_251_TO_999 ? (
{company[row.year].workforce?.range !== CompanyWorkforceRange.Enum.FROM_251_TO_999 ? (
<>
<Text inline variant="bold" text={`${row.salaryRaisesAndPromotionsScore ?? "NC"}`} />
{row.notComputableReasonSalaryRaisesAndPromotions && (
Expand All @@ -203,7 +203,7 @@ export const TileCompanyIndex = (dto: SearchDeclarationResultDTO) => {
</>
)}
</li>
{company[row.year].workforce?.range !== CompanyWorkforceRange.Enum.FROM_251_TO_999 && (
{company[row.year].workforce?.range !== CompanyWorkforceRange.Enum.FROM_50_TO_250 && (
<li>
Écart taux promotion : <Text inline variant="bold" text={`${row.promotionsScore ?? "NC"}`} />
{row.notComputableReasonPromotions && (
Expand Down

0 comments on commit 87982e4

Please sign in to comment.