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 7867b1a commit 92af00b
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions packages/canyon-backend/src/task/syns.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ export class SynsService {
) {
}

// @Timeout(1)
@Timeout(1)
async mainTask() {
// 1.查出07-12 12:00以前的coverage数据
const ids = await this.prisma.coverage.findMany({
where:{
projectID:{
not:{
contains:'-ut'
}
},
updatedAt: {
lt: new Date('2024-07-12 12:00:00'),
// gte: new Date('2024-07-12 00:00:00')
}
// projectID:{
// not:{
// // contains:'-ut'
// }
// },
// updatedAt: {
// // lt: new Date('2024-07-12 12:00:00'),
// // gte: new Date('2024-07-12 00:00:00')
// }
},
select:{
id:true,
Expand Down Expand Up @@ -88,9 +88,9 @@ export class SynsService {
return {
id: `__${projectID}__${sha}__${path}__`,
mapJsonStr: JSON.stringify({
fnMap: fileCoverage.fnMap,
statementMap: fileCoverage.statementMap,
branchMap: fileCoverage.branchMap,
fnMap: fileCoverage.fnMap||{},
statementMap: fileCoverage.statementMap||{},
branchMap: fileCoverage.branchMap||{},
}),
projectID:projectID,
sha:sha,
Expand Down Expand Up @@ -120,26 +120,26 @@ export class SynsService {
const time3 = new Date().getTime();


// await this.prisma.covHit
// .create({
// data: {
// id: `__${ids[i].id}__`,
// mapJsonStr: JSON.stringify(Object.entries(coverage).reduce((previousValue, currentValue:any)=>{
// previousValue[currentValue[0]] = {
// f: currentValue[1].f,
// b: currentValue[1].b,
// s: currentValue[1].s,
// }
// return previousValue
// },{})),
// },
// })
// .then((res) => {
// return res;
// })
// .catch((e) => {
// return true;
// });
await this.prisma.covHit
.create({
data: {
id: `__${ids[i].id}__`,
mapJsonStr: JSON.stringify(Object.entries(coverage).reduce((previousValue, currentValue:any)=>{
previousValue[currentValue[0]] = {
f: currentValue[1].f||{},
b: currentValue[1].b||{},
s: currentValue[1].s||{},
}
return previousValue
},{})),
},
})
.then((res) => {
return res;
})
.catch((e) => {
return true;
});


console.log('hitTasks', new Date().getTime() - time3);
Expand Down

0 comments on commit 92af00b

Please sign in to comment.