Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
tev
plugin_event
Commits
0498b874
Commit
0498b874
authored
Mar 30, 2017
by
LE GAC Renaud
Browse files
Updated report_tools to fix bugs in Metric2D and Graph.
parent
7e15a695
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
18 deletions
+23
-18
modules/plugin_event/report_tools.py
modules/plugin_event/report_tools.py
+23
-18
No files found.
modules/plugin_event/report_tools.py
View file @
0498b874
...
...
@@ -198,7 +198,7 @@ class Graph(object):
config
=
metric2d
.
config
selector
=
metric2d
.
selector
selector
.
graph
=
selector
.
graph
selector
.
graph
=
json
.
loads
(
selector
.
graph
)
config_graph
=
(
selector
.
graph
if
selector
.
is_graph
else
config
.
graph
)
...
...
@@ -641,30 +641,33 @@ class Metric2D(BaseReport):
config
=
self
.
config
selector
=
self
.
selector
config_x
=
config
.
summary_x
config_y
=
config
.
summary_y
is_summary_x
=
selector
.
is_summary_x
is_summary_y
=
selector
.
is_summary_y
selector_x
=
selector
.
summary_x
selector_y
=
selector
.
summary_y
if
selector
.
is_summary_x
:
selector_x
=
selector
.
summary_x
summary_x
=
{
u
"functions"
:
selector_x
[
0
],
u
"labels"
:
selector_x
[
1
]}
else
:
summary_x
=
config
.
summary_x
summary_x
=
(
selector_x
if
is_summary_x
else
config_x
)
summary_y
=
(
selector_y
if
is_summary_y
else
config_y
)
if
selector
.
is_summary_y
:
selector_y
=
selector
.
summary_y
summary_y
=
{
u
"functions"
:
selector_y
[
0
],
u
"labels"
:
selector_y
[
1
]}
else
:
summary_y
=
config
.
summary_y
# preserve the original DataFrame in order to avoid pollution
# when series of summaries is computed
self
.
df0
=
df
# add summary rows and or columns
is_summary
=
\
self
.
is_summary
=
is_summary
=
\
(
summary_x
is
not
None
and
len
(
summary_x
[
"functions"
])
>
0
)
or
\
(
summary_y
is
not
None
and
len
(
summary_y
[
"functions"
])
>
0
)
if
is_summary
:
self
.
df0
=
df0
=
df
.
copy
()
self
.
is_summary
=
True
dfx
=
self
.
summaries
(
df0
,
summary_x
,
axis
=
"columns"
)
df
=
pd
.
concat
((
df
,
dfx
),
axis
=
"columns"
)
...
...
@@ -688,9 +691,11 @@ class Metric2D(BaseReport):
df (pandas.DataFrame):
config (dict): configuration parameters for summaries:
* compute (bool)
* function(s) (str): string or list JSON-encoded
* label(s) (str): string or list JSON-encoded
* functions (str):
- string of values separated by comma
- list JSON-encoded
* labels (str): string of values separated by comma
axis (str): either ``rows`` of ``columns``.
...
...
@@ -708,8 +713,8 @@ class Metric2D(BaseReport):
if
funcs
in
(
""
,
'""'
,
"''"
,
'[]'
):
return
df1
if
not
isinstance
(
funcs
,
list
):
return
df1
if
isinstance
(
funcs
,
(
str
,
unicode
)
):
funcs
=
funcs
.
split
(
","
)
labels
=
config
[
u
"labels"
]
if
labels
in
(
""
,
'""'
,
"''"
,
"[]"
):
...
...
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