Convert value for more date filters; only add condition if valid
missed these in 187fea6d1b
This commit is contained in:
parent
c43a4edec7
commit
365e4a4194
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2021 Lance Edgar
|
# Copyright © 2010-2022 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -699,6 +699,30 @@ class AlchemyDateFilter(AlchemyGridFilter):
|
||||||
self.column != self.encode_value(date),
|
self.column != self.encode_value(date),
|
||||||
))
|
))
|
||||||
|
|
||||||
|
def filter_greater_than(self, query, value):
|
||||||
|
date = self.make_date(value)
|
||||||
|
if not date:
|
||||||
|
return query
|
||||||
|
return query.filter(self.column > self.encode_value(date))
|
||||||
|
|
||||||
|
def filter_greater_equal(self, query, value):
|
||||||
|
date = self.make_date(value)
|
||||||
|
if not date:
|
||||||
|
return query
|
||||||
|
return query.filter(self.column >= self.encode_value(date))
|
||||||
|
|
||||||
|
def filter_less_than(self, query, value):
|
||||||
|
date = self.make_date(value)
|
||||||
|
if not date:
|
||||||
|
return query
|
||||||
|
return query.filter(self.column < self.encode_value(date))
|
||||||
|
|
||||||
|
def filter_less_equal(self, query, value):
|
||||||
|
date = self.make_date(value)
|
||||||
|
if not date:
|
||||||
|
return query
|
||||||
|
return query.filter(self.column <= self.encode_value(date))
|
||||||
|
|
||||||
def filter_between(self, query, value):
|
def filter_between(self, query, value):
|
||||||
"""
|
"""
|
||||||
Filter data with a "between" query. Really this uses ">=" and "<="
|
Filter data with a "between" query. Really this uses ">=" and "<="
|
||||||
|
|
Loading…
Reference in a new issue