summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Snapshots/model.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Server/Snapshots/model.py')
-rw-r--r--src/lib/Server/Snapshots/model.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/Server/Snapshots/model.py b/src/lib/Server/Snapshots/model.py
index e5306da64..cd2e617f5 100644
--- a/src/lib/Server/Snapshots/model.py
+++ b/src/lib/Server/Snapshots/model.py
@@ -249,3 +249,12 @@ class Snapshot(Base):
@classmethod
def get_current(cls, session, clientname):
return session.query(Snapshot).join(Snapshot.client_metadata, Metadata.client).filter(Client.name==clientname).order_by(desc(Snapshot.timestamp)).first()
+
+ @classmethod
+ def get_by_date(cls, session, clientname, timestamp):
+ return session.query(Snapshot)\
+ .join(Snapshot.client_metadata, Metadata.client)\
+ .filter(Snapshot.timestamp < timestamp)\
+ .filter(Client.name==clientname)\
+ .order_by(desc(Snapshot.timestamp))\
+ .first()