Skip to content
Snippets Groups Projects
Commit d8076bec authored by Alexis POYEN's avatar Alexis POYEN
Browse files

Refactor : prevent useless affectation and code usage

parent 047471eb
No related branches found
No related tags found
No related merge requests found
...@@ -181,31 +181,30 @@ class DeskRoundSelector { ...@@ -181,31 +181,30 @@ class DeskRoundSelector {
} }
async loadDesks() { async loadDesks() {
let deskRoundHandler = this; let selectRound = document.getElementById("round-select");
let deskRounds = await this.DeskRoundModel.getDeskRounds();
deskRounds = deskRounds.filter((deskRound) => { if (selectRound.value != 0) {
return deskRound.RoundID == deskRoundHandler.RoundID; let deskRoundHandler = this;
}); let deskRounds = await this.DeskRoundModel.getDeskRounds();
// Filter the desks to display only the one affected to capturer
if (this.DeskRoundModel.current_user.role === "CAPTURER") { deskRounds = deskRounds.filter((deskRound) => {
let capturer = await this.CapturerModel.getCapturerByUserID( return deskRound.RoundID == deskRoundHandler.RoundID;
this.DeskRoundModel.current_user.id });
); // Filter the desks to display only the one affected to capturer
let deskRoundsToKeep = []; if (this.DeskRoundModel.current_user.role === "CAPTURER") {
for (let i in deskRounds) { let capturer = await this.CapturerModel.getCapturerByUserID(
for (let j in capturer.DeskRounds) { this.DeskRoundModel.current_user.id
if (capturer.DeskRounds[j].ID == deskRounds[i].ID) );
deskRoundsToKeep.push(deskRounds[i]); let deskRoundsToKeep = [];
for (let i in deskRounds) {
for (let j in capturer.DeskRounds) {
if (capturer.DeskRounds[j].ID == deskRounds[i].ID)
deskRoundsToKeep.push(deskRounds[i]);
}
} }
deskRounds = deskRoundsToKeep;
} }
deskRounds = deskRoundsToKeep;
}
let selectRound = document.getElementById("round-select");
if (selectRound.value == 0) {
deskRounds = [];
} else {
let deskRoundsFiltered = []; let deskRoundsFiltered = [];
let selectArea = document.getElementById("area-select"); let selectArea = document.getElementById("area-select");
if (selectArea.value != 0) { if (selectArea.value != 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment