Add date to filter of expression
closes #1308 It is now possible to get a history in a range of date with something like: boobank history CC-1234@ing --condition "date>2013-12-01 AND date<2013-12-8" It displays transactions done betwenn the 2th and the 7th december.
This commit is contained in:
parent
0513e86628
commit
505a5e9fef
1 changed files with 6 additions and 1 deletions
|
|
@ -17,6 +17,8 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import weboob.tools.date as date_utils
|
||||
from datetime import date
|
||||
|
||||
__all__ = ['ResultsCondition', 'ResultsConditionError']
|
||||
|
||||
|
|
@ -93,7 +95,10 @@ class ResultsCondition(IResultsCondition):
|
|||
# We have to change the type of v, always gived as string by application
|
||||
typed = type(d[condition.left])
|
||||
try:
|
||||
tocompare = typed(condition.right)
|
||||
if isinstance(d[condition.left], date_utils.date):
|
||||
tocompare = date(*[int(x) for x in condition.right.split('-')])
|
||||
else:
|
||||
tocompare = typed(condition.right)
|
||||
myeval = functions[condition.op](tocompare, d[condition.left])
|
||||
except:
|
||||
myeval = False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue