Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Zhang (张涛) committed Mar 26, 2024
1 parent dd24380 commit 14ba0c1
Showing 1 changed file with 30 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,34 +50,45 @@ export class GetProjectRecordsService {

const rows = [];

const csList = await Promise.all(
coverages.map((coverage) =>
this.prisma.coverage.findMany({
where: {
projectID,
sha: coverage.sha,
covType: 'agg',
},
orderBy: {
createdAt: 'desc',
},
}),
),
);

const summarysList = await Promise.all(
coverages.map((coverage) =>
this.prisma.summary.findMany({
where: {
sha: coverage.sha,
covType: 'all',
metricType: {
in: ['statements', 'newlines'],
},
},
}),
),
);
for (let i = 0; i < coverages.length; i++) {
const coverage = coverages[i];
const summarys = await this.prisma.summary.findMany({
where: {
sha: coverage.sha,
covType: 'all',
metricType: {
in: ['statements', 'newlines'],
},
},
});
const summarys = summarysList[i];
const s = summarys.find((item) => {
return item.sha === coverage.sha && item.metricType === 'statements';
}) || { covered: 0, total: 0 };
const l = summarys.find((item) => {
return item.sha === coverage.sha && item.metricType === 'newlines';
}) || { covered: 0, total: 0 };

const cs = await this.prisma.coverage.findMany({
where: {
projectID,
sha: coverage.sha,
covType: 'agg',
},
orderBy: {
createdAt: 'desc',
},
});
const cs = csList[i];

const data = {
...coverage,
Expand Down

0 comments on commit 14ba0c1

Please sign in to comment.