Skip to content

Commit

Permalink
feat: Remove undefined properties in qualification object
Browse files Browse the repository at this point in the history
  • Loading branch information
LucsT committed Feb 2, 2024
1 parent c88d681 commit 9d6d110
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/cozy-client/src/models/document/qualification.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,16 @@ export class Qualification {
/**
* @type {string?}
*/
this.purpose = attributes.purpose || qualification.purpose
this.sourceCategory =
const purpose = attributes.purpose || qualification.purpose
if (purpose) this.purpose = purpose
const sourceCategory =
attributes.sourceCategory || qualification.sourceCategory
this.sourceSubCategory =
if (sourceCategory) this.sourceCategory = sourceCategory
const sourceSubCategory =
attributes.sourceSubCategory || qualification.sourceSubCategory
this.subjects = attributes.subjects || qualification.subjects
if (sourceSubCategory) this.sourceSubCategory = sourceSubCategory
const subjects = attributes.subjects || qualification.subjects
if (subjects) this.subjects = subjects
} else {
throw new Error(`No qualification found for the label ${label}`)
}
Expand Down Expand Up @@ -209,6 +213,7 @@ export class Qualification {
* @returns {Qualification} - The qualification
*/
Qualification.getByLabel = label => {
console.log('INQUALIFFFFFFF')
return new Qualification(label)
}

Expand Down

0 comments on commit 9d6d110

Please sign in to comment.