Skip to content
GitLab
Explore
Sign in
Commits on Source (6)
Update the clean_sql_files script
· 23637bb1
Marco De Donno
authored
Apr 22, 2021
23637bb1
Change the title for the list of references on the target page
· b201a880
Marco De Donno
authored
Apr 22, 2021
b201a880
Patch the show_folder_inner() function for afis users
· 4176a2d1
Marco De Donno
authored
Apr 22, 2021
4176a2d1
Doc update for the show_folder_inner() function
· ae6c0070
Marco De Donno
authored
Apr 22, 2021
ae6c0070
Update the download and upload buttons labels for afis users
· 659de2e0
Marco De Donno
authored
Apr 22, 2021
659de2e0
Move the check for the related pfsp zones in the get_marks_list_for_target_folder() function
· 5085cdea
Marco De Donno
authored
Apr 22, 2021
5085cdea
Hide whitespace changes
Inline
Side-by-side
sql/clean_sql_files.sh
View file @
5085cdea
#!/bin/bash
find
.
-name
'*.sql'
-exec
sed
-i
'/^-- Dump/d'
{}
\;
find
.
-name
'*.sql'
-exec
sed
-i
-e
'/^--/d'
-e
'/^$/N;/^\n$/D'
-e
's/OWNER TO postgres;/OWNER TO icnml;/g'
{}
\;
views/afis/__init__.py
View file @
5085cdea
...
...
@@ -139,7 +139,19 @@ def get_marks_list_for_target_folder( uuid, admin = True ):
cnm_folder.uuid = %s AND
files_type.name =
'
mark_target
'
"""
return
config
.
db
.
query_fetchall
(
sql
,
(
uuid
,
)
)
marks_list
=
[]
marks_list_tmp
=
config
.
db
.
query_fetchall
(
sql
,
(
uuid
,
)
)
sql
=
"
SELECT pc FROM cnm_folder WHERE uuid = %s
"
pc
=
config
.
db
.
query_fetchone
(
sql
,
(
uuid
,
)
)[
"
pc
"
]
for
m
in
marks_list_tmp
:
for
z
in
m
[
"
pfsp
"
].
split
(
"
,
"
):
if
pc
in
pfsp2fpc
[
z
]:
marks_list
.
append
(
m
)
return
marks_list
def
get_annotation_list_for_target_folder
(
uuid
,
admin
=
True
):
sql
=
"""
...
...
@@ -153,35 +165,38 @@ def get_annotation_list_for_target_folder( uuid, admin = True ):
return
config
.
db
.
query_fetchall
(
sql
,
(
uuid
,
)
)
def
show_folder_inner
(
uuid
,
admin
):
"""
This function get all the data related to particular target
(annotations, marks, refs and assignments), for admins and afis users.
"""
# Redirect non-admins if not assigned to this folder
if
not
admin
:
sql
=
"
SELECT count(*) FROM cnm_assignment WHERE folder_uuid = %s AND user_id = %s
"
if
config
.
db
.
query_fetchone
(
sql
,
(
uuid
,
session
.
get
(
"
user_id
"
),
)
)[
"
count
"
]
==
0
:
return
redirect
(
url_for
(
"
base.home
"
)
)
# Get the annotations, references and marks lists
segments_list
=
get_segment_list_for_target_folder
(
uuid
,
admin
)
annotation_list
=
get_annotation_list_for_target_folder
(
uuid
,
admin
)
marks_list_tmp
=
get_marks_list_for_target_folder
(
uuid
,
admin
)
marks_list
=
get_marks_list_for_target_folder
(
uuid
,
admin
)
# Generic information
sql
=
"""
SELECT
submissions.uuid,
cnm_folder.pc,
users.username
FROM cnm_folder
INNER JOIN submissions ON cnm_folder.donor_id = submissions.donor_id
INNER JOIN users ON cnm_folder.donor_id = users.id
WHERE cnm_folder.uuid = %s
"""
submission_id
,
pc
,
username
=
config
.
db
.
query_fetchone
(
sql
,
(
uuid
,
)
)
finger_name
=
"
{} (F{})
"
.
format
(
segments_position_code
[
pc
],
pc
)
# User assignments
if
admin
:
sql
=
"""
SELECT
submissions.uuid,
cnm_folder.pc,
users.username
FROM cnm_folder
INNER JOIN submissions ON cnm_folder.donor_id = submissions.donor_id
INNER JOIN users ON cnm_folder.donor_id = users.id
WHERE cnm_folder.uuid = %s
"""
submission_id
,
pc
,
username
=
config
.
db
.
query_fetchone
(
sql
,
(
uuid
,
)
)
finger_name
=
"
{} (F{})
"
.
format
(
segments_position_code
[
pc
],
pc
)
marks_list
=
[]
for
m
in
marks_list_tmp
:
for
z
in
m
[
"
pfsp
"
].
split
(
"
,
"
):
if
pc
in
pfsp2fpc
[
z
]:
marks_list
.
append
(
m
)
sql
=
"""
SELECT
users.id,
...
...
views/afis/templates/afis/shared/segment.html
View file @
5085cdea
...
...
@@ -160,12 +160,12 @@
<div
class=
"icnml_buttons_list"
>
<div
class=
"icnml_button"
>
<a
class=
"ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only icnml_button"
id=
"download_folder"
role=
"button"
aria-disabled=
"false"
>
<span
class=
"ui-button-text"
>
Get folder
</span>
<span
class=
"ui-button-text"
>
Download
</span>
</a>
</div>
<div
class=
"icnml_button"
>
<a
class=
"ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only icnml_button"
id=
"upload_cnm"
role=
"button"
aria-disabled=
"false"
>
<span
class=
"ui-button-text"
>
Upload
</span>
<span
class=
"ui-button-text"
>
Upload
a CNM
</span>
</a>
</div>
</div>
...
...
@@ -228,7 +228,7 @@
{% if segments_list != None %}
<div
class=
"icnml_list_of_boxes_outer"
>
<div
class=
"icnml_list_of_boxes_desc"
>
Non annotated imag
es ({{ segments_list|length }})
</div>
<div
class=
"icnml_list_of_boxes_desc"
>
Referenc
es ({{ segments_list|length }})
</div>
<div
class=
"icnml_list_of_boxes"
>
{% for s in segments_list %}
<div
id=
"segment_{{ s[ 'folder_uuid' ] }}_outer"
>
...
...