Commit dbeaff27 authored by Aurélien Campéas's avatar Aurélien Campéas
Browse files

insertion_date: follow tshistory change

parent 49aa45863584
...@@ -281,7 +281,7 @@ def test_strip(engine, tsh): ...@@ -281,7 +281,7 @@ def test_strip(engine, tsh):
ts = genserie(datetime(2019, 1, 1), 'D', 3) ts = genserie(datetime(2019, 1, 1), 'D', 3)
tsh.insert( tsh.insert(
engine, ts, 'strip-unsupervised', 'test', engine, ts, 'strip-unsupervised', 'test',
_insertion_date=utcdt(2019, 1, 1) insertion_date=utcdt(2019, 1, 1)
) )
csid = tsh.changeset_at(engine, 'strip-unsupervised', utcdt(2019, 1, 1)) csid = tsh.changeset_at(engine, 'strip-unsupervised', utcdt(2019, 1, 1))
tsh.strip(engine, 'strip-unsupervised', csid) tsh.strip(engine, 'strip-unsupervised', csid)
...@@ -290,7 +290,7 @@ def test_strip(engine, tsh): ...@@ -290,7 +290,7 @@ def test_strip(engine, tsh):
tsh.insert( tsh.insert(
engine, ts, 'strip-handcrafted', 'test', engine, ts, 'strip-handcrafted', 'test',
manual=True, manual=True,
_insertion_date=utcdt(2019, 1, 1) insertion_date=utcdt(2019, 1, 1)
) )
csid = tsh.changeset_at(engine, 'strip-handcrafted', utcdt(2019, 1, 1)) csid = tsh.changeset_at(engine, 'strip-handcrafted', utcdt(2019, 1, 1))
tsh.strip(engine, 'strip-handcrafted', csid) tsh.strip(engine, 'strip-handcrafted', csid)
...@@ -298,13 +298,13 @@ def test_strip(engine, tsh): ...@@ -298,13 +298,13 @@ def test_strip(engine, tsh):
ts = genserie(datetime(2019, 1, 1), 'D', 3) ts = genserie(datetime(2019, 1, 1), 'D', 3)
tsh.insert( tsh.insert(
engine, ts, 'strip-supervised', 'test', engine, ts, 'strip-supervised', 'test',
_insertion_date=utcdt(2019, 1, 1) insertion_date=utcdt(2019, 1, 1)
) )
ts = genserie(datetime(2019, 1, 2), 'D', 3) ts = genserie(datetime(2019, 1, 2), 'D', 3)
tsh.insert( tsh.insert(
engine, ts, 'strip-supervised', 'test', engine, ts, 'strip-supervised', 'test',
manual=True, manual=True,
_insertion_date=utcdt(2019, 1, 2) insertion_date=utcdt(2019, 1, 2)
) )
with pytest.raises(ValueError) as err: with pytest.raises(ValueError) as err:
......
...@@ -76,13 +76,13 @@ class timeseries(basets): ...@@ -76,13 +76,13 @@ class timeseries(basets):
@tx @tx
def insert(self, cn, ts, name, author, def insert(self, cn, ts, name, author,
metadata=None, metadata=None,
_insertion_date=None, manual=False): insertion_date=None, manual=False):
if not self.exists(cn, name): if not self.exists(cn, name):
# initial insert # initial insert
diff = super().insert( diff = super().insert(
cn, ts, name, author, cn, ts, name, author,
metadata=metadata, metadata=metadata,
_insertion_date=_insertion_date insertion_date=insertion_date
) )
if diff is None: if diff is None:
return return
...@@ -103,7 +103,7 @@ class timeseries(basets): ...@@ -103,7 +103,7 @@ class timeseries(basets):
self.upstream.insert( self.upstream.insert(
cn, current, name, author, cn, current, name, author,
metadata=metadata, metadata=metadata,
_insertion_date=_insertion_date insertion_date=insertion_date
) )
# update supervision status # update supervision status
meta = self.metadata(cn, name) meta = self.metadata(cn, name)
...@@ -113,7 +113,7 @@ class timeseries(basets): ...@@ -113,7 +113,7 @@ class timeseries(basets):
return super().insert( return super().insert(
cn, ts, name, author, cn, ts, name, author,
metadata=metadata, metadata=metadata,
_insertion_date=_insertion_date insertion_date=insertion_date
) )
assert supervision_status in ('supervised', 'handcrafted') assert supervision_status in ('supervised', 'handcrafted')
...@@ -124,7 +124,7 @@ class timeseries(basets): ...@@ -124,7 +124,7 @@ class timeseries(basets):
diff = self.upstream.insert( diff = self.upstream.insert(
cn, ts, name, author, cn, ts, name, author,
metadata=metadata, metadata=metadata,
_insertion_date=_insertion_date insertion_date=insertion_date
) )
if supervision_status == 'handcrafted': if supervision_status == 'handcrafted':
...@@ -140,7 +140,7 @@ class timeseries(basets): ...@@ -140,7 +140,7 @@ class timeseries(basets):
a = super().insert( a = super().insert(
cn, diff, name, author, cn, diff, name, author,
metadata=metadata, metadata=metadata,
_insertion_date=_insertion_date insertion_date=insertion_date
) )
return a return a
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment