Skip to content
Snippets Groups Projects
Commit 68ce0fcc authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

MAINT: allow time deviation

parent c3dea802
Branches
Tags
No related merge requests found
......@@ -47,6 +47,7 @@ from .guard import INSERT, RETRIEVE, UPDATE
from .guard import global_guard as guard
from .verbosity import DEBUG, INFO, VERBOSE
from datetime import timedelta
class Crawler(object):
def __init__(self, food, access=lambda x: x, use_cache=False,
......@@ -273,6 +274,13 @@ class Crawler(object):
query_string += " WITH "
for p in entity.get_properties():
if p.datatype == db.DATETIME:
small_val = p.value-timedelta(seconds=15)
large_val = p.value+timedelta(seconds=15)
query_string += (
"'" + p.name + "'>'" + small_val.isoformat().split("+")[0] + "' AND "
"'" + p.name + "'<'" + large_val.isoformat().split("+")[0] + "' AND ")
else:
query_string += ("'" + p.name + "'='" + str(get_value(p))
+ "' AND ")
# remove the last AND
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment