Skip to content

Commit

Permalink
fix: handle declarations with missing data or insufficient duration (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
arturlg authored Feb 27, 2024
1 parent 813f9f8 commit fb10251
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ export class PostgresDeclarationRepo implements IDeclarationRepo {

public async getAllBySiren(siren: Siren): Promise<Declaration[]> {
try {
const raws = await this.sql`select * from ${this.table} where siren=${siren.getValue()} ${this.postgresLimit}`;
const raws = await this.sql`select * from ${this.table} where siren=${siren.getValue()} and data notnull ${
this.postgresLimit
}`;

return raws.map(declarationMap.toDomain);
} catch (error: unknown) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ enum declarationOpmcStatus {

const getDeclarationOpmcStatus = (declaration?: DeclarationOpmcDTO) => {
if (!declaration) return declarationOpmcStatus.NOT_APPLICABLE;
if (declaration?.["periode-reference"]?.périodeSuffisante === "non") return declarationOpmcStatus.NOT_APPLICABLE;
const { after2021, index, initialValuesObjectifsMesures, objectifsMesuresSchema } =
buildHelpersObjectifsMesures(declaration);

Expand Down

0 comments on commit fb10251

Please sign in to comment.