Skip to content

Commit 7afe81e

Browse files
committed
fix #328 : fix import new HAL notice
1 parent bb96dd9 commit 7afe81e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

api/src/core/usecases/importFromSource.ts

+13
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,20 @@ export const importFromHALSource: (dbApi: DbApiV2) => (agentEmail: string) => Pr
2727
const index = dbSoftwaresNames.indexOf(software.title_s[0]);
2828

2929
if (index != -1) {
30+
if (dbSoftwares[index].externalId === software.docid) {
31+
return dbSoftwares[index].softwareId;
32+
}
33+
34+
// Not equal -> new HAL notice version, need to update
35+
const newSoft = await halRawSoftwareToSoftwareForm(software);
36+
await dbApi.software.update({
37+
softwareSillId: dbSoftwares[index].softwareId,
38+
formData: newSoft,
39+
agentId: agentId
40+
});
41+
3042
return dbSoftwares[index].softwareId;
43+
3144
} else {
3245
console.info("Importing HAL : ", software.docid);
3346
const newSoft = await halRawSoftwareToSoftwareForm(software);

0 commit comments

Comments
 (0)