Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pony
tshistory_supervision
Commits
fc9c57de0d85
Commit
52fa68a7
authored
Jun 22, 2018
by
Aurélien Campéas
Browse files
timeserie: create manual/auto serie handler at init time rather than at .insert / get_marker time
parent
e56fbde1165b
Changes
1
Hide whitespace changes
Inline
Side-by-side
tshistory_supervision/tsio.py
View file @
fc9c57de
...
@@ -53,11 +53,15 @@ class TimeSerie(BaseTS):
...
@@ -53,11 +53,15 @@ class TimeSerie(BaseTS):
explicitly.
explicitly.
"""
"""
def
__init__
(
self
,
*
a
,
**
kw
):
super
().
__init__
(
*
a
,
**
kw
)
self
.
manual_store
=
BaseTS
(
namespace
=
'{}-manual'
.
format
(
self
.
namespace
))
self
.
auto_store
=
BaseTS
(
namespace
=
'{}-automatic'
.
format
(
self
.
namespace
))
def
insert
(
self
,
cn
,
ts
,
name
,
author
,
_insertion_date
=
None
,
manual
=
False
):
def
insert
(
self
,
cn
,
ts
,
name
,
author
,
_insertion_date
=
None
,
manual
=
False
):
if
manual
:
if
manual
:
basetsh
=
BaseTS
(
namespace
=
'{}-manual'
.
format
(
self
.
namespace
))
# insert & compute diff over synthetic
# insert & compute diff over synthetic
diff
=
basetsh
.
insert
(
diff
=
self
.
manual_store
.
insert
(
cn
,
ts
,
name
,
author
,
_insertion_date
=
_insertion_date
cn
,
ts
,
name
,
author
,
_insertion_date
=
_insertion_date
)
)
...
@@ -67,8 +71,7 @@ class TimeSerie(BaseTS):
...
@@ -67,8 +71,7 @@ class TimeSerie(BaseTS):
else
:
else
:
# insert & compute diff over automatic
# insert & compute diff over automatic
basetsh
=
BaseTS
(
namespace
=
'{}-automatic'
.
format
(
self
.
namespace
))
diff
=
self
.
auto_store
.
insert
(
diff
=
basetsh
.
insert
(
cn
,
ts
,
name
,
author
,
cn
,
ts
,
name
,
author
,
_insertion_date
=
_insertion_date
_insertion_date
=
_insertion_date
)
)
...
@@ -90,7 +93,7 @@ class TimeSerie(BaseTS):
...
@@ -90,7 +93,7 @@ class TimeSerie(BaseTS):
if
table
is
None
:
if
table
is
None
:
return
None
,
None
return
None
,
None
autotsh
=
BaseTS
(
namespace
=
'{}-automatic'
.
format
(
self
.
namespace
))
autotsh
=
self
.
auto_store
auto
=
autotsh
.
get
(
cn
,
name
,
auto
=
autotsh
.
get
(
cn
,
name
,
revision_date
=
revision_date
,
revision_date
=
revision_date
,
from_value_date
=
from_value_date
,
from_value_date
=
from_value_date
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment