Skip to content

Commit

Permalink
Updated designation checking with designation type
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajandeep98 committed Oct 27, 2023
1 parent b91ec46 commit 766f8c8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,14 +489,18 @@ export const resubmit = async ({ commit, getters }): Promise<boolean> => {

// add resubmit NR number (for internal use only - API ignores it)
nrTypeData['resubmitNrNum'] = nrData['nrNum']

// check against entity types if it should have designation or not : if length returns to be 0 then NR should not have any designation otherwise work as getNameDesignation
let flag = false
if (Designations[nrData['entity_type_cd']].words.length === 0) {
flag = true
}
// clean names data
nrTypeData['names'] = nrData.names.map(name => ({
choice: name.choice,
consent_words: '',
conflict1: '',
conflict1_num: '',
designation: getNameDesignation(name),
designation: !flag ? getNameDesignation(name) : '',
name: name.name,
name_type_cd: name.name_type_cd
}))
Expand Down Expand Up @@ -525,7 +529,6 @@ function getNameDesignation (name: any): string {
if (name.designation) return name.designation
const words = name.name.split(' ')
const len = words.length
if (EntityTypes.FR || EntityTypes.GP || EntityTypes.DBA || EntityTypes.FI || EntityTypes.PA || EntityTypes.PAR) return ''
return words[len - 1]
}

Expand Down

0 comments on commit 766f8c8

Please sign in to comment.