Fix removing dates from a filter

This commit is contained in:
kolaente 2021-04-15 21:45:34 +02:00
parent 2f213beb03
commit e673d965d5
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 7 additions and 0 deletions

View File

@ -310,6 +310,8 @@ export default {
this.prepareRelatedObjectFilter('namespace') this.prepareRelatedObjectFilter('namespace')
}, },
removePropertyFromFilter(propertyName) { removePropertyFromFilter(propertyName) {
// Because of the way arrays work, we can only ever remove one element at once.
// To remove multiple filter elements of the same name this function has to be called multiple times.
for (const i in this.params.filter_by) { for (const i in this.params.filter_by) {
if (this.params.filter_by[i] === propertyName) { if (this.params.filter_by[i] === propertyName) {
this.params.filter_by.splice(i, 1) this.params.filter_by.splice(i, 1)
@ -354,7 +356,12 @@ export default {
this.params.filter_value.push(formatISO(new Date(parts[1]))) this.params.filter_value.push(formatISO(new Date(parts[1])))
} }
this.change() this.change()
return
} }
this.removePropertyFromFilter(filterName)
this.removePropertyFromFilter(filterName)
this.change()
}, },
prepareDate(filterName, variableName) { prepareDate(filterName, variableName) {
if (typeof this.params.filter_by === 'undefined') { if (typeof this.params.filter_by === 'undefined') {