Skip to content

Commit b3a63a6

Browse files
author
fangedShadow
committed
fixed linting of the branch
1 parent f86d703 commit b3a63a6

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

src/components/WeeklySummariesReport/WeeklySummariesReport.jsx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -672,23 +672,23 @@ export class WeeklySummariesReport extends Component {
672672
try {
673673
const { replaceCode, selectedCodes, summaries, teamCodes } = this.state;
674674
this.setState({ replaceCodeLoading: true });
675-
675+
676676
const isValidCode = fullCodeRegex.test(replaceCode);
677677
if (!isValidCode) {
678678
this.setState({
679679
replaceCodeError: 'NOT SAVED! The code must be between 5 and 7 characters long.',
680680
});
681681
return;
682682
}
683-
683+
684684
const oldTeamCodes = selectedCodes.map(code => code.value);
685-
685+
686686
// Call the new backend API with a POST request
687687
const response = await axios.post(ENDPOINTS.REPLACE_TEAM_CODE, {
688688
oldTeamCodes,
689689
newTeamCode: replaceCode,
690690
});
691-
691+
692692
if (response.data?.updatedCount > 0) {
693693
// Update the summaries in the local state
694694
const updatedSummaries = summaries.map(summary => {
@@ -697,33 +697,37 @@ export class WeeklySummariesReport extends Component {
697697
}
698698
return summary;
699699
});
700-
700+
701701
// Remove old team codes and add the new team code in teamCodes
702702
const updatedTeamCodes = teamCodes
703703
.filter(teamCode => !oldTeamCodes.includes(teamCode.value)) // Remove old team codes
704704
.concat({
705705
value: replaceCode,
706-
label: `${replaceCode} (${updatedSummaries.filter(s => s.teamCode === replaceCode).length})`,
706+
label: `${replaceCode} (${
707+
updatedSummaries.filter(s => s.teamCode === replaceCode).length
708+
})`,
707709
_ids: updatedSummaries.filter(s => s.teamCode === replaceCode).map(s => s._id),
708710
});
709-
711+
710712
// Remove old team codes and add the new team code in selectedCodes
711713
const updatedSelectedCodes = selectedCodes
712714
.filter(code => !oldTeamCodes.includes(code.value)) // Remove old team codes
713715
.concat({
714716
value: replaceCode,
715-
label: `${replaceCode} (${updatedSummaries.filter(s => s.teamCode === replaceCode).length})`,
717+
label: `${replaceCode} (${
718+
updatedSummaries.filter(s => s.teamCode === replaceCode).length
719+
})`,
716720
_ids: updatedSummaries.filter(s => s.teamCode === replaceCode).map(s => s._id),
717721
});
718-
722+
719723
this.setState({
720724
summaries: updatedSummaries,
721725
teamCodes: updatedTeamCodes,
722726
selectedCodes: updatedSelectedCodes,
723727
replaceCode: '',
724728
replaceCodeError: null,
725729
});
726-
730+
727731
// Re-filter the summaries to update the table
728732
this.filterWeeklySummaries();
729733
} else {
@@ -732,7 +736,6 @@ export class WeeklySummariesReport extends Component {
732736
});
733737
}
734738
} catch (error) {
735-
console.error('Error in handleAllTeamCodeReplace:', error); // Log the error for debugging
736739
this.setState({
737740
replaceCodeError: 'Something went wrong. Please try again!',
738741
});

0 commit comments

Comments
 (0)