feat(official-tournaments): add 'not-interested' status handling and update member interest logic
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 55s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 55s
This commit is contained in:
@@ -340,8 +340,14 @@ class OfficialTournamentService {
|
||||
row.registered = false;
|
||||
row.participated = false;
|
||||
break;
|
||||
case 'not-interested':
|
||||
row.wants = false;
|
||||
row.registered = false;
|
||||
row.participated = false;
|
||||
row.placement = null;
|
||||
break;
|
||||
default: {
|
||||
const err = new Error('Invalid action. Use: register, participate, or reset');
|
||||
const err = new Error('Invalid action. Use: register, participate, reset, or not-interested');
|
||||
err.status = 400;
|
||||
throw err;
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@
|
||||
<td class="action-cell">
|
||||
<button
|
||||
v-if="!item.participated && !item.registered && !item.wants"
|
||||
@click="markMemberInterested(group.memberId)"
|
||||
@click="markMemberInterested(item)"
|
||||
class="btn-status btn-register"
|
||||
title="Als interessiert markieren">
|
||||
Interessiert
|
||||
@@ -327,6 +327,13 @@
|
||||
title="Als angemeldet markieren">
|
||||
Angemeldet
|
||||
</button>
|
||||
<button
|
||||
v-if="!item.participated && !item.registered && item.wants"
|
||||
@click="updateStatus(item, 'not-interested')"
|
||||
class="btn-status btn-reset"
|
||||
title="Interesse für diese Konkurrenz zurücknehmen">
|
||||
Nicht interessiert
|
||||
</button>
|
||||
<button
|
||||
v-else-if="item.registered && !item.participated"
|
||||
@click="updateStatus(item, 'participate')"
|
||||
@@ -1813,19 +1820,12 @@ export default {
|
||||
'success'
|
||||
);
|
||||
},
|
||||
async markMemberInterested(memberId) {
|
||||
const competitions = ((this.parsed?.parsedData?.competitions) || [])
|
||||
.filter((competition) => {
|
||||
const member = (this.members || []).find((entry) => String(entry.id) === String(memberId));
|
||||
return member && this.isEligibleForCompetition(member, competition);
|
||||
});
|
||||
|
||||
for (const competition of competitions) {
|
||||
const participation = this.getParticipation(competition.id, memberId);
|
||||
if (participation.wants || participation.registered || participation.participated) continue;
|
||||
participation.wants = true;
|
||||
await this.saveParticipation(competition.id, memberId);
|
||||
}
|
||||
async markMemberInterested(item) {
|
||||
const [competitionId, memberId] = String(item.key).split('-');
|
||||
const participation = this.getParticipation(competitionId, memberId);
|
||||
if (participation.wants || participation.registered || participation.participated) return;
|
||||
participation.wants = true;
|
||||
await this.saveParticipation(competitionId, memberId);
|
||||
},
|
||||
async updateStatusForCompetition(competition, member, action) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user