Skip to content

Commit 8910c95

Browse files
committed
refactor code
1 parent a9dbb10 commit 8910c95

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

server/claim/claim-revision/claim-revision.service.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,11 @@ export class ClaimRevisionService {
204204
if (sources && Array.isArray(sources)) {
205205
for (let source of sources) {
206206
try {
207-
const existingSource = await this.sourceService.findHref(source);
208-
if (existingSource && existingSource.length > 0) {
209-
for (let source of existingSource) {
210-
await this.sourceService.updateTargetId(source._id, claimId);
211-
}
207+
const existingSources = await this.sourceService.findHref(source);
208+
if (existingSources && existingSources.length > 0) {
209+
await Promise.all(existingSources.map(source =>
210+
this.sourceService.updateTargetId(source._id, claimId)
211+
));
212212
} else {
213213
await this.sourceService.create({
214214
href: source,

0 commit comments

Comments
 (0)