X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=plomtask%2Fversioned_attributes.py;h=b3442d7df1030b72b2990a21e12ffa12302aa9d1;hb=8945aa6762977c04538c49c320417311b38232be;hp=ab39df098059e416c7627b5fcefecae2668d7c06;hpb=a0244482692edf794960f3c2af9461be2ad15e8a;p=plomtask diff --git a/plomtask/versioned_attributes.py b/plomtask/versioned_attributes.py index ab39df0..b3442d7 100644 --- a/plomtask/versioned_attributes.py +++ b/plomtask/versioned_attributes.py @@ -51,6 +51,8 @@ class VersionedAttribute: def at(self, queried_time: str) -> str | float: """Retrieve value of timestamp nearest queried_time from the past.""" + if len(queried_time) == 10: + queried_time += ' 23:59:59.999' sorted_timestamps = sorted(self.history.keys()) if 0 == len(sorted_timestamps): return self.default @@ -66,3 +68,7 @@ class VersionedAttribute: db_conn.rewrite_relations(self.table_name, 'parent', self.parent.id_, [[item[0], item[1]] for item in self.history.items()]) + + def remove(self, db_conn: DatabaseConnection) -> None: + """Remove from DB.""" + db_conn.delete_where(self.table_name, 'parent', self.parent.id_)