aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-search/advanced-search.model.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-search/advanced-search.model.ts')
-rw-r--r--client/src/app/shared/shared-search/advanced-search.model.ts20
1 files changed, 6 insertions, 14 deletions
diff --git a/client/src/app/shared/shared-search/advanced-search.model.ts b/client/src/app/shared/shared-search/advanced-search.model.ts
index 9c55f6cd8..2675c6135 100644
--- a/client/src/app/shared/shared-search/advanced-search.model.ts
+++ b/client/src/app/shared/shared-search/advanced-search.model.ts
@@ -1,3 +1,4 @@
1import { intoArray } from '@app/helpers'
1import { 2import {
2 BooleanBothQuery, 3 BooleanBothQuery,
3 BooleanQuery, 4 BooleanQuery,
@@ -74,8 +75,8 @@ export class AdvancedSearch {
74 this.categoryOneOf = options.categoryOneOf || undefined 75 this.categoryOneOf = options.categoryOneOf || undefined
75 this.licenceOneOf = options.licenceOneOf || undefined 76 this.licenceOneOf = options.licenceOneOf || undefined
76 this.languageOneOf = options.languageOneOf || undefined 77 this.languageOneOf = options.languageOneOf || undefined
77 this.tagsOneOf = this.intoArray(options.tagsOneOf) 78 this.tagsOneOf = intoArray(options.tagsOneOf)
78 this.tagsAllOf = this.intoArray(options.tagsAllOf) 79 this.tagsAllOf = intoArray(options.tagsAllOf)
79 this.durationMin = parseInt(options.durationMin, 10) 80 this.durationMin = parseInt(options.durationMin, 10)
80 this.durationMax = parseInt(options.durationMax, 10) 81 this.durationMax = parseInt(options.durationMax, 10)
81 82
@@ -150,9 +151,9 @@ export class AdvancedSearch {
150 originallyPublishedStartDate: this.originallyPublishedStartDate, 151 originallyPublishedStartDate: this.originallyPublishedStartDate,
151 originallyPublishedEndDate: this.originallyPublishedEndDate, 152 originallyPublishedEndDate: this.originallyPublishedEndDate,
152 nsfw: this.nsfw, 153 nsfw: this.nsfw,
153 categoryOneOf: this.intoArray(this.categoryOneOf), 154 categoryOneOf: intoArray(this.categoryOneOf),
154 licenceOneOf: this.intoArray(this.licenceOneOf), 155 licenceOneOf: intoArray(this.licenceOneOf),
155 languageOneOf: this.intoArray(this.languageOneOf), 156 languageOneOf: intoArray(this.languageOneOf),
156 tagsOneOf: this.tagsOneOf, 157 tagsOneOf: this.tagsOneOf,
157 tagsAllOf: this.tagsAllOf, 158 tagsAllOf: this.tagsAllOf,
158 durationMin: this.durationMin, 159 durationMin: this.durationMin,
@@ -198,13 +199,4 @@ export class AdvancedSearch {
198 199
199 return true 200 return true
200 } 201 }
201
202 private intoArray (value: any) {
203 if (!value) return undefined
204 if (Array.isArray(value)) return value
205
206 if (typeof value === 'string') return value.split(',')
207
208 return [ value ]
209 }
210} 202}