Skip to content

Commit 3401e1f

Browse files
chore(merge): merge develop into main
2 parents e4ba136 + 59198b2 commit 3401e1f

16 files changed

Lines changed: 78 additions & 56 deletions

File tree

.github/workflows/main-v2.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171

7272
- run: bun install --no-cache
7373

74-
- run: bun nx affected -t lint test build
74+
- run: bun nx affected -t lint test build -c ci
7575

7676
- name: Run Playwright tests
7777
run: bun nx affected --parallel 1 -t e2e-ci
@@ -99,6 +99,8 @@ jobs:
9999
100100
## for copy pasting in shell
101101
# bun playwright show-report
102+
- name: coverage reports
103+
run: npx --yes lcov-result-merger 'coverage/**/lcov.info' 'coverage/lcov.info'
102104

103105
- name: Set Git config
104106
run: |
@@ -123,6 +125,19 @@ jobs:
123125
path: playwright-report/
124126
retention-days: 30
125127

128+
- uses: actions/upload-artifact@v3
129+
if: always()
130+
with:
131+
name: coverage-report
132+
path: coverage/lcov.info
133+
retention-days: 30
134+
135+
- name: SonarCloud Scan
136+
uses: SonarSource/sonarcloud-github-action@master
137+
env:
138+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
140+
126141
- name: Merge main -> develop
127142
uses: devmasx/merge-branch@master
128143
if: github.ref == 'refs/heads/main'

apps/worker/sync/src/app/processors/check-encounters/pupeteer/getDetailAccepted.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,11 @@ export async function detailAccepted(
3636
for (const row of rows) {
3737
const th = await row.$('th');
3838
if (th) {
39-
// logger.verbose(`Processing row`);
4039
const thTxt = (await th.evaluate((el) => el.textContent)) || '';
4140
if (thTxt.indexOf('Teamwedstrijd bevestigd') !== -1) {
4241
const td = await row.$('td');
4342
if (td) {
4443
const tdTxt = (await td.evaluate((el) => el.textContent)) || '';
45-
// logger.verbose(`Processing td: ${text}`);
4644
if (tdTxt !== 'Nee') {
4745
hasAccepted = true;
4846

@@ -61,6 +59,6 @@ export async function detailAccepted(
6159
}
6260
}
6361

64-
return { accepted: hasAccepted ? true : false, acceptedOn, acceptedBy };
62+
return { accepted: !!hasAccepted, acceptedOn, acceptedBy };
6563
}
6664
}

apps/worker/sync/src/app/processors/check-encounters/pupeteer/getDetailEntered.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export async function detailEntered(
3434
let enteredOn: Date | null = null;
3535
const enteredBy: string | null = null;
3636
for (const row of rows) {
37-
// logger.verbose(`Processing row`);
3837
const th = await row.$('th');
3938
if (th) {
4039
const headerTxt = (await th.evaluate((el) => el.textContent)) || '';

apps/worker/sync/src/app/processors/check-encounters/pupeteer/getTime.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export async function hasTime(
3232
for (const row of rows) {
3333
const header = await row.$('th');
3434
if (header) {
35-
// logger.verbose(`Processing row`);
3635
const text = await header.evaluate((el) => el.textContent);
3736
if (text?.indexOf('Tijdstip') !== -1) {
3837
const td = await row.$('td');

apps/worker/sync/src/app/processors/global.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,4 @@ export class GlobalConsumer {
1717
onError(job: string, err: Error) {
1818
this.logger.error(`Job ${job} failed`, err);
1919
}
20-
21-
// @OnQueueActive()
22-
// handleQueueActive(job: Job) {
23-
// this.logger.log(`[SYNC] Queue ${job.name} is active`);
24-
25-
// // super.handleQueueActive(job);
26-
// }
2720
}

apps/worker/sync/src/app/processors/sync-events/competition-sync/processors/draw.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,20 @@ export class CompetitionSyncDrawProcessor extends StepProcessor {
8080
dbDraw = new DrawCompetition({
8181
visualCode: `${xmlDraw.Code}`,
8282
subeventId: subEvent.id,
83-
type:
84-
xmlDraw.TypeID === XmlDrawTypeID.Elimination
85-
? DrawType.KO
86-
: xmlDraw.TypeID === XmlDrawTypeID.RoundRobin ||
87-
xmlDraw.TypeID === XmlDrawTypeID.FullRoundRobin
88-
? DrawType.POULE
89-
: DrawType.QUALIFICATION,
83+
type: getDrawType(xmlDraw.TypeID),
9084
});
85+
86+
function getDrawType(typeID: XmlDrawTypeID): DrawType {
87+
switch (typeID) {
88+
case XmlDrawTypeID.Elimination:
89+
return DrawType.KO;
90+
case XmlDrawTypeID.RoundRobin:
91+
case XmlDrawTypeID.FullRoundRobin:
92+
return DrawType.POULE;
93+
default:
94+
return DrawType.QUALIFICATION;
95+
}
96+
}
9197
}
9298
// update the draw
9399
dbDraw.size = xmlDraw.Size;

apps/worker/sync/src/app/processors/sync-events/competition-sync/processors/encounter-location.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class CompetitionSyncEncounterLocationProcessor extends StepProcessor {
2828

2929
const teamIds = this.encounters
3030
.map((encounter) => encounter.encounter.homeTeamId ?? null)
31-
.filter((id) => id !== null) as string[];
31+
.filter((id) => id !== null);
3232

3333
const teams = await Team.findAll({
3434
where: {
@@ -94,7 +94,7 @@ export class CompetitionSyncEncounterLocationProcessor extends StepProcessor {
9494
// get the location for the club
9595
const locations = club.locations?.filter((location) => location.availabilities?.length);
9696

97-
if (!locations || !locations.length) {
97+
if (!locations?.length) {
9898
this.logger.warn(
9999
`No locations found for club ${club.id} for encounter ${encounter.encounter.id}`,
100100
);

apps/worker/sync/src/app/processors/sync-events/competition-sync/processors/event.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,6 @@ export class CompetitionSyncEventProcessor extends StepProcessor {
4040

4141
if (!event) {
4242
existed = false;
43-
const dates: Moment[] = [];
44-
for (
45-
let date = moment(this.visualTournament.StartDate);
46-
date.diff(this.visualTournament.EndDate, 'days') <= 0;
47-
date.add(1, 'days')
48-
) {
49-
dates.push(date.clone());
50-
}
51-
5243
const visualTournament = await this.visualService.getTournament(this.visualTournament.Code);
5344

5445
this.logger.debug(`EventCompetition ${visualTournament.Name} not found, creating`);
@@ -57,11 +48,10 @@ export class CompetitionSyncEventProcessor extends StepProcessor {
5748
visualCode: visualTournament.Code,
5849
season: moment(visualTournament.StartDate).year(),
5950
});
60-
} else {
61-
// Later we will change the search function to use the tournament code
62-
if (event.visualCode === null || event.visualCode !== this.visualTournament.Code) {
63-
event.visualCode = this.visualTournament.Code;
64-
}
51+
}
52+
// Later we will change the search function to use the tournament code
53+
else if (event.visualCode === null || event.visualCode !== this.visualTournament.Code) {
54+
event.visualCode = this.visualTournament.Code;
6555
}
6656

6757
event.lastSync = new Date();

apps/worker/sync/src/app/processors/sync-events/competition-sync/processors/game.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ export class CompetitionSyncGameProcessor extends StepProcessor {
108108
xmlMatch.Sets.Set = [xmlMatch?.Sets?.Set];
109109
}
110110

111-
let gameStatus = GameStatus.NORMAL;
111+
let gameStatus: GameStatus;
112+
112113
switch (xmlMatch.ScoreStatus) {
113114
case XmlScoreStatus.Retirement:
114115
gameStatus = GameStatus.RETIREMENT;
@@ -122,8 +123,8 @@ export class CompetitionSyncGameProcessor extends StepProcessor {
122123
case XmlScoreStatus.Walkover:
123124
gameStatus = GameStatus.WALKOVER;
124125
break;
125-
default:
126126
case XmlScoreStatus.Normal:
127+
default:
127128
gameStatus = GameStatus.NORMAL;
128129
break;
129130
}

libs/backend/competition/change-encounter/src/services/validate/rules/team-club.rule.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export class TeamClubRule extends Rule {
5151
throw new Error('Working encounter not found');
5252
}
5353

54-
// this.logger.debug(`Encounter found in semester ${semseter1 ? 1 : 2}`);
5554
const encountersSemester1 = [...encountersSem1];
5655
const encountersSemester2 = [...encountersSem2];
5756

0 commit comments

Comments
 (0)