mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Use 1/0 instead of true/false
This commit is contained in:
parent
f6d78a0044
commit
1c83f489d1
@ -313,7 +313,10 @@ export class FilterEditorComponent implements OnInit, OnDestroy {
|
||||
break
|
||||
case FILTER_ASN_ISNULL:
|
||||
this.textFilterTarget = TEXT_FILTER_TARGET_ASN
|
||||
this.textFilterModifier = TEXT_FILTER_MODIFIER_NULL
|
||||
this.textFilterModifier =
|
||||
rule.value == 'true' || rule.value == '1'
|
||||
? TEXT_FILTER_MODIFIER_NULL
|
||||
: TEXT_FILTER_MODIFIER_NOTNULL
|
||||
break
|
||||
case FILTER_ASN_GT:
|
||||
this.textFilterTarget = TEXT_FILTER_TARGET_ASN
|
||||
|
@ -15,7 +15,7 @@ export function generateParams(
|
||||
): Params {
|
||||
let params = {}
|
||||
params[SORT_FIELD_PARAMETER] = sortField
|
||||
params[SORT_REVERSE_PARAMETER] = sortReverse
|
||||
params[SORT_REVERSE_PARAMETER] = sortReverse ? 1 : undefined
|
||||
params[PAGE_PARAMETER] = isNaN(currentPage) ? 1 : currentPage
|
||||
return {
|
||||
...queryParamsFromFilterRules(filterRules),
|
||||
@ -41,7 +41,9 @@ export function getStateFromQueryParams(queryParams: ParamMap): ListViewState {
|
||||
}
|
||||
}
|
||||
|
||||
export function filterRulesFromQueryParams(queryParams: ParamMap) {
|
||||
export function filterRulesFromQueryParams(
|
||||
queryParams: ParamMap
|
||||
): FilterRule[] {
|
||||
const allFilterRuleQueryParams: string[] = FILTER_RULE_TYPES.map(
|
||||
(rt) => rt.filtervar
|
||||
)
|
||||
@ -67,6 +69,8 @@ export function filterRulesFromQueryParams(queryParams: ParamMap) {
|
||||
filterRulesFromQueryParams = filterRulesFromQueryParams.concat(
|
||||
// map all values to filter rules
|
||||
filterQueryParamValues.map((val) => {
|
||||
if (rule_type.datatype == 'boolean')
|
||||
val = val.replace('1', 'true').replace('0', 'false')
|
||||
return {
|
||||
rule_type: rule_type.id,
|
||||
value: isNullRuleType ? null : val,
|
||||
@ -88,9 +92,12 @@ export function queryParamsFromFilterRules(filterRules: FilterRule[]): Params {
|
||||
? params[ruleType.filtervar] + ',' + rule.value
|
||||
: rule.value
|
||||
} else if (ruleType.isnull_filtervar && rule.value == null) {
|
||||
params[ruleType.isnull_filtervar] = true
|
||||
params[ruleType.isnull_filtervar] = 1
|
||||
} else {
|
||||
params[ruleType.filtervar] = rule.value
|
||||
if (ruleType.datatype == 'boolean')
|
||||
params[ruleType.filtervar] =
|
||||
rule.value == 'true' || rule.value == '1' ? 1 : 0
|
||||
}
|
||||
}
|
||||
return params
|
||||
|
Loading…
x
Reference in New Issue
Block a user