Skip to content
GitLab
Explore
Sign in
Commits on Source (3)
Remove the trainer search pfsp_sel variable
· c9c11b91
Marco De Donno
authored
Feb 21, 2020
c9c11b91
Patch the trainer mark search to work with the detection technic and the surface
· c43d900f
Marco De Donno
authored
Feb 21, 2020
c43d900f
Search also thruth the name of the zone in the trainer mark search page
· 0d357392
Marco De Donno
authored
Feb 21, 2020
0d357392
Hide whitespace changes
Inline
Side-by-side
views/trainer/__init__.py
View file @
0d357392
...
...
@@ -91,12 +91,23 @@ def search():
pfsp2fpc
[
"
Right-writer_palm
"
].
append
(
22
)
pfsp2fpc
[
"
Left-writer_palm
"
].
append
(
24
)
pfspdesc
=
{}
n
=
1
for
laterality
in
[
"
Right
"
,
"
Left
"
]:
for
finger
in
[
"
thumb
"
,
"
index
"
,
"
middel
"
,
"
ring
"
,
"
little
"
]:
for
zone
in
[
"
tip
"
,
"
distal
"
,
"
medial
"
,
"
proximal
"
]:
pfspdesc
[
"
F{}-{}
"
.
format
(
n
,
zone
)
]
=
"
{} {} {}
"
.
format
(
laterality
,
finger
,
zone
)
d
=
"
F{}-{} -> {} {} {}
"
.
format
(
n
,
zone
,
laterality
,
finger
,
zone
)
current_app
.
logger
.
info
(
d
)
n
+=
1
#
return
my_render_template
(
return
my_render_template
(
"
trainer/search.html
"
,
marks
=
marks
,
refs
=
refs
,
pfsp2fpc
=
pfsp2fpc
,
pfspdesc
=
pfspdesc
,
all_detection_technics
=
all_detection_technics
,
surfaces
=
surfaces
,
all_pfsp
=
pfsp
.
zones
...
...
views/trainer/templates/trainer/search.html
View file @
0d357392
...
...
@@ -74,19 +74,6 @@
<script
type=
"text/javascript"
>
baseurl
=
"
{{ baseurl }}
"
;
var
marks
=
{};
{
%
for
mark
in
marks
%
}
marks
[
"
{{ mark[ 'uuid' ] }}
"
]
=
{
"
uuid
"
:
"
{{ mark[ 'uuid' ] }}
"
,
"
id
"
:
"
{{ mark[ 'id' ] }}
"
,
"
pfsp
"
:
"
{{ mark[ 'pfsp' ] }}
"
.
split
(
"
,
"
),
"
submission_uuid
"
:
"
{{ mark[ 'submission_uuid' ] }}
"
,
"
dt
"
:
"
{{ mark[ 'detection_technic' ] }}
"
.
split
(
"
,
"
),
"
surface
"
:
"
{{ mark[ 'surface' ] }}
"
.
split
(
"
,
"
),
"
note
"
:
"
{{ mark[ 'note' ] | default( '', true ) }}
"
};
{
%
endfor
%
}
var
surfaces
=
{};
{
%
for
s
in
surfaces
%
}
surfaces
[
"
{{ s[ 'id' ] }}
"
]
=
"
{{ s[ 'name' ] }}
"
;
...
...
@@ -97,15 +84,6 @@
all_detection_technics
[
"
{{ dt[ 'id' ] }}
"
]
=
"
{{ dt[ 'name' ] }}
"
;
{
%
endfor
%
}
var
pfsp_sel
=
{};
{
%
for
pfsp
in
all_pfsp
%
}
var
tmp
=
[];
{
%
for
sel
in
pfsp
[
'
sel
'
]
%
}
tmp
.
push
(
"
{{ sel }}
"
);
{
%
endfor
%
}
pfsp_sel
[
"
{{ pfsp[ 'desc' ] }}
"
]
=
tmp
;
{
%
endfor
%
}
var
pfsp2fpc
=
{};
{
%
for
pfsp
,
fpc
in
pfsp2fpc
.
iteritems
()
%
}
pfsp2fpc
[
"
{{ pfsp }}
"
]
=
[];
...
...
@@ -113,9 +91,39 @@
{
%
for
f
in
fpc
%
}
pfsp2fpc
[
"
{{ pfsp }}
"
].
push
(
"
{{ f }}
"
);
{
%
endfor
%
}
{
%
endfor
%
}
var
pfsp_desc
=
{};
{
%
for
pfsp
,
desc
in
pfspdesc
.
iteritems
()
%
}
pfsp_desc
[
"
{{ pfsp }}
"
]
=
"
{{ desc }}
"
;
{
%
endfor
%
}
var
marks
=
{};
{
%
for
mark
in
marks
%
}
marks
[
"
{{ mark[ 'uuid' ] }}
"
]
=
{
"
uuid
"
:
"
{{ mark[ 'uuid' ] }}
"
,
"
id
"
:
"
{{ mark[ 'id' ] }}
"
,
"
pfsp
"
:
"
{{ mark[ 'pfsp' ] }}
"
.
split
(
"
,
"
),
"
pfsp_desc
"
:
[],
"
submission_uuid
"
:
"
{{ mark[ 'submission_uuid' ] }}
"
,
"
surface
"
:
[],
"
dt
"
:
[],
"
note
"
:
"
{{ mark[ 'note' ] | default( '', true ) }}
"
};
_
.
forEach
(
"
{{ mark[ 'surface' ] }}
"
.
split
(
"
,
"
),
function
(
s
)
{
marks
[
"
{{ mark[ 'uuid' ] }}
"
][
"
surface
"
].
push
(
surfaces
[
s
]
);
}
);
_
.
forEach
(
"
{{ mark[ 'detection_technic' ] }}
"
.
split
(
"
,
"
),
function
(
dt
)
{
marks
[
"
{{ mark[ 'uuid' ] }}
"
][
"
dt
"
].
push
(
all_detection_technics
[
dt
]
);
}
);
_
.
forEach
(
"
{{ mark[ 'pfsp' ] }}
"
.
split
(
"
,
"
),
function
(
pfsp
)
{
marks
[
"
{{ mark[ 'uuid' ] }}
"
][
"
pfsp_desc
"
].
push
(
pfsp_desc
[
pfsp
]
);
}
);
{
%
endfor
%
}
var
update_filter_search
=
function
()
{
var
selected
=
$
(
this
).
val
().
split
(
"
"
);
...
...
@@ -337,22 +345,11 @@
$
(
"
#mark_{{ mark[ 'uuid' ] }}_pfsp
"
)
.
text
(
marks
[
"
{{ mark[ 'uuid' ] }}
"
][
"
pfsp
"
].
join
(
"
,
"
)
);
var
surface
=
[];
_
.
forEach
(
marks
[
"
{{ mark[ 'uuid' ] }}
"
][
"
surface
"
],
function
(
s
)
{
surface
.
push
(
surfaces
[
s
]
);
}
);
$
(
"
#mark_{{ mark[ 'uuid' ] }}_surface
"
)
.
text
(
surface
.
join
(
"
,
"
)
);
.
text
(
marks
[
"
{{ mark[ 'uuid' ] }}
"
][
"
surface
"
]
.
join
(
"
,
"
)
);
var
dt
=
[];
_
.
forEach
(
marks
[
"
{{ mark[ 'uuid' ] }}
"
][
"
dt
"
],
function
(
s
)
{
dt
.
push
(
all_detection_technics
[
s
]
);
}
);
$
(
"
#mark_{{ mark[ 'uuid' ] }}_dt
"
)
.
html
(
dt
.
join
(
"
<br>
"
)
);
.
html
(
marks
[
"
{{ mark[ 'uuid' ] }}
"
][
"
dt
"
].
join
(
"
<br>
"
)
);
{
%
endfor
%
}
$
(
"
#filter_search
"
).
on
(
"
keyup
"
,
update_filter_search
);
...
...