Skip to content
Snippets Groups Projects
Commit da15b22d authored by Hugo NOUTS's avatar Hugo NOUTS
Browse files

fix(orientation): pmrAccess tag no longer duplicate

parent 84fff92b
Branches
Tags
2 merge requests!608V2.4.2,!583Resolve "[Orientation] - Bug Tag"
......@@ -249,10 +249,15 @@ export class OrientationUtils {
public manuallySetOfPmr(filters: Filter[], event: { name: string; value: boolean }): void {
// Handle special PMR access case
if (event.name === 'pmrAccess') {
const filterIndex = filters.findIndex((f) => f.name === 'pmrAccess');
if (event.value) {
filters.push(new Filter('pmrAccess', 'True', 'PMR'));
} else {
filters = filters.filter((module) => module.name !== 'pmrAccess');
if (filterIndex === -1) {
filters.push(new Filter('pmrAccess', 'True', 'Accessible PMR'));
} // If filter already exists with value true, do nothing
} else if (filterIndex !== -1) {
// If filter exists, remove it
filters.splice(filterIndex, 1);
}
}
}
......
......@@ -115,10 +115,14 @@ export class Utils {
public convertFiltersToModule(filters: Filter[]): Module[] {
const modules: Module[] = [];
// Add checked box filter
// Add checked box filter + special handling for pmrAccess that is not a module like the rest of accessModality items
filters.forEach((filter) => {
if (filter.name !== 'query') {
modules.push(new Module(filter.value, filter.name, filter.text));
if (filter.name === 'pmrAccess') {
modules.push(new Module('True', 'accessModality', 'Accessible PMR'));
} else {
modules.push(new Module(filter.value, filter.name, filter.text));
}
}
});
return modules;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment