Skip to content

Commit

Permalink
feat: update
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Zhang (张涛) committed Jul 14, 2024
1 parent 070b5d9 commit 910455e
Showing 1 changed file with 30 additions and 20 deletions.
50 changes: 30 additions & 20 deletions packages/canyon-backend/src/task/syns.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,31 +76,41 @@ export class SynsService {
const fileMapTasks = Object.entries(coverage).map(
async (coverageEntries) => {
const [path, fileCoverage]: any = coverageEntries;
await this.prisma.covMapTest
.create({
data: {
id: `__${projectID}__${sha}__${path}__`,
mapJsonStr: JSON.stringify({
fnMap: fileCoverage.fnMap,
statementMap: fileCoverage.statementMap,
branchMap: fileCoverage.branchMap,
}),
projectID:projectID,
sha:sha,
path,
},
})
.then((res) => {
return res;
})
.catch(() => {
return true;
});

},
);
const time2 = new Date().getTime();
await Promise.all(fileMapTasks);


const rows = Object.entries(coverage).map((coverageEntries)=>{
const [path, fileCoverage]: any = coverageEntries;
return {
id: `__${projectID}__${sha}__${path}__`,
mapJsonStr: JSON.stringify({
fnMap: fileCoverage.fnMap,
statementMap: fileCoverage.statementMap,
branchMap: fileCoverage.branchMap,
}),
projectID:projectID,
sha:sha,
path,
}
})


await this.prisma.covMapTest
.createMany({
data: rows,
skipDuplicates: true,
})
.then((res) => {
return res;
})
.catch(() => {
return true;
});

console.log('fileMapTasks', new Date().getTime() - time2);


Expand Down

0 comments on commit 910455e

Please sign in to comment.