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 {
}
async loadDesks() {
let deskRoundHandler = this;
let deskRounds = await this.DeskRoundModel.getDeskRounds();
let selectRound = document.getElementById("round-select");
deskRounds = deskRounds.filter((deskRound) => {
return deskRound.RoundID == deskRoundHandler.RoundID;
});
// Filter the desks to display only the one affected to capturer
if (this.DeskRoundModel.current_user.role === "CAPTURER") {
let capturer = await this.CapturerModel.getCapturerByUserID(
this.DeskRoundModel.current_user.id
);
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]);
if (selectRound.value != 0) {
let deskRoundHandler = this;
let deskRounds = await this.DeskRoundModel.getDeskRounds();
deskRounds = deskRounds.filter((deskRound) => {
return deskRound.RoundID == deskRoundHandler.RoundID;
});
// Filter the desks to display only the one affected to capturer
if (this.DeskRoundModel.current_user.role === "CAPTURER") {
let capturer = await this.CapturerModel.getCapturerByUserID(
this.DeskRoundModel.current_user.id
);
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 selectArea = document.getElementById("area-select");
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