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
limbra
limbra
Commits
2e2cc99d
Commit
2e2cc99d
authored
Jan 11, 2016
by
LE GAC Renaud
Browse files
Local improvement for speed.
parent
8993142a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
39 deletions
+46
-39
modules/callbacks.py
modules/callbacks.py
+6
-6
modules/check_tools.py
modules/check_tools.py
+40
-33
No files found.
modules/callbacks.py
View file @
2e2cc99d
...
...
@@ -131,11 +131,11 @@ def INHIBIT_DUPLICATE_PUBLICATION(publication):
"""
db
,
T
=
current
.
globalenv
[
'db'
],
current
.
T
categories
=
db
.
categories
id_category
=
publication
[
'id_categories'
]
# articles
id_cats
=
(
get_id
(
db
.
categories
,
code
=
'ACL'
),
get_id
(
db
.
categories
,
code
=
'ACLN'
))
id_cats
=
(
get_id
(
categories
,
code
=
'ACL'
),
get_id
(
categories
,
code
=
'ACLN'
))
if
id_category
in
id_cats
:
ids
=
duplicate_article
(
publication
)
...
...
@@ -152,9 +152,9 @@ def INHIBIT_DUPLICATE_PUBLICATION(publication):
return
True
# talks and proceedings
id_cats
=
(
get_id
(
db
.
categories
,
code
=
'ACTI'
),
get_id
(
db
.
categories
,
code
=
'ACTN'
),
get_id
(
db
.
categories
,
code
=
'COM'
))
id_cats
=
(
get_id
(
categories
,
code
=
'ACTI'
),
get_id
(
categories
,
code
=
'ACTN'
),
get_id
(
categories
,
code
=
'COM'
))
if
id_category
in
id_cats
:
ids
=
duplicate_conference
(
publication
,
id_category
!=
id_cats
[
2
])
...
...
@@ -171,7 +171,7 @@ def INHIBIT_DUPLICATE_PUBLICATION(publication):
return
True
# reports
id_cats
=
(
get_id
(
db
.
categories
,
code
=
'AP'
),)
id_cats
=
(
get_id
(
categories
,
code
=
'AP'
),)
if
id_category
in
id_cats
:
ids
=
duplicate_report
(
publication
)
...
...
modules/check_tools.py
View file @
2e2cc99d
...
...
@@ -23,7 +23,7 @@ def check_publication(row):
Args:
row (gluon.dal.Row): record defining a publication.
Its contains the publication
s
table as well as its foreign tables.
Its contains the publication table as well as its foreign tables.
Returns:
tuple:
...
...
@@ -33,55 +33,62 @@ def check_publication(row):
"""
T
,
li
,
idset
=
current
.
T
,
[],
set
()
categories
=
row
.
categories
category_code
=
categories
.
code
category_usual
=
categories
.
usual
publication
=
row
.
publications
# status code
if
row
.
status
.
code
==
'???'
:
text
=
T
(
"The status is ???"
)
li
.
append
(
text
)
# category
if
row
.
categor
ies
.
code
==
UNDEF
:
if
categor
y_
code
==
UNDEF
:
text
=
T
(
"The category is undefined"
)
li
.
append
(
text
)
# team
if
row
.
publication
s
.
id_teams
==
UNDEF_ID
:
if
publication
.
id_teams
==
UNDEF_ID
:
text
=
T
(
"The team is undefined"
)
li
.
append
(
text
)
# project
if
row
.
publication
s
.
id_projects
==
UNDEF_ID
:
if
publication
.
id_projects
==
UNDEF_ID
:
text
=
T
(
"The project is undefined"
)
li
.
append
(
text
)
# authors list
if
'et al'
in
row
.
publication
s
.
authors
:
if
'et al'
in
publication
.
authors
:
text
=
T
(
"'et al.' in authors"
)
li
.
append
(
text
)
# CPPM authors (team name, ...)
if
row
.
teams
.
team
in
row
.
publication
s
.
authors_institute
:
if
row
.
teams
.
team
in
publication
.
authors_institute
:
text
=
T
(
"The institute authors contains the team name?"
)
li
.
append
(
text
)
# submitted date
if
not
row
.
publications
.
submitted
:
submitted
=
publication
.
submitted
if
not
submitted
:
text
=
T
(
"Submitted date is not defined"
)
li
.
append
(
text
)
if
row
.
publications
.
submitted
:
if
not
REG_SUBMITTED
.
match
(
row
.
publications
.
submitted
):
if
submitted
:
if
not
REG_SUBMITTED
.
match
(
submitted
):
text
=
T
(
"Submitted date is not valid"
)
li
.
append
(
text
)
# publication URL
if
row
.
publications
.
publication_url
:
if
'pdf'
not
in
row
.
publications
.
publication_url
:
publication_url
=
publication
.
publication_url
if
publication_url
:
if
'pdf'
not
in
publication_url
:
text
=
\
T
(
"Check that the publication URL corresponds to a pdf file."
)
li
.
append
(
text
)
# latex syntax
title
=
row
.
publication
s
.
title
title
=
publication
.
title
rules
=
"√"
in
title
or
\
(
"^"
in
title
and
"$"
not
in
title
)
or
\
(
"→"
in
title
and
"$"
not
in
title
)
or
\
...
...
@@ -94,7 +101,7 @@ def check_publication(row):
li
.
append
(
text
)
# "Note :" in report number
value
=
row
.
publication
s
.
report_numbers
value
=
publication
.
report_numbers
rules
=
"Note :"
in
value
or
\
"Note:"
in
value
or
\
";"
in
value
...
...
@@ -104,82 +111,82 @@ def check_publication(row):
li
.
append
(
text
)
# duplicate by origin
ids
=
duplicate_origin
(
row
.
publication
s
)
ids
=
duplicate_origin
(
publication
)
if
len
(
ids
):
idset
=
idset
.
union
(
ids
)
text
=
T
(
"Entries with duplicate origin"
)
li
.
append
(
text
)
# specific fields for article
if
row
.
categor
ies
.
code
in
(
'ACL'
,
'ACLN'
):
if
categor
y_
code
in
(
'ACL'
,
'ACLN'
):
if
row
.
publication
s
.
id_publishers
==
UNDEF_ID
:
if
publication
.
id_publishers
==
UNDEF_ID
:
text
=
T
(
"Publishers is not defined"
)
li
.
append
(
text
)
if
not
row
.
publication
s
.
volume
:
if
not
publication
.
volume
:
text
=
T
(
"Volume number is not defined"
)
li
.
append
(
text
)
if
not
row
.
publication
s
.
pages
:
if
not
publication
.
pages
:
text
=
T
(
"Pages range is not defined"
)
li
.
append
(
text
)
if
not
row
.
publication
s
.
preprint
:
if
not
publication
.
preprint
:
text
=
T
(
"Preprint number is not defined"
)
li
.
append
(
text
)
ids
=
duplicate_article
(
row
.
publication
s
)
ids
=
duplicate_article
(
publication
)
if
ids
:
idset
=
idset
.
union
(
ids
)
text
=
T
(
"Possible duplicate entries"
)
li
.
append
(
text
)
# specific fields for preprint
if
row
.
categor
ies
.
code
==
'PRE'
:
if
categor
y_
code
==
'PRE'
:
if
not
row
.
publication
s
.
preprint
:
if
not
publication
.
preprint
:
text
=
T
(
"Preprint number is not defined"
)
li
.
append
(
text
)
# specific fields for proceeding and talk
if
row
.
categor
ies
.
usual
in
(
'proceeding'
,
'talk'
):
if
categor
y_
usual
in
(
'proceeding'
,
'talk'
):
if
not
row
.
publication
s
.
conference_title
:
if
not
publication
.
conference_title
:
text
=
T
(
"Conference title is not defined"
)
li
.
append
(
text
)
if
not
row
.
publication
s
.
conference_dates
:
if
not
publication
.
conference_dates
:
text
=
T
(
"Conference dates is not defined"
)
li
.
append
(
text
)
if
not
row
.
publication
s
.
conference_town
:
if
not
publication
.
conference_town
:
text
=
T
(
"Conference town is not defined"
)
li
.
append
(
text
)
if
not
row
.
publication
s
.
id_countries
:
if
not
publication
.
id_countries
:
text
=
T
(
"Conference country is not defined"
)
li
.
append
(
text
)
if
not
row
.
publication
s
.
conference_speaker
:
if
not
publication
.
conference_speaker
:
text
=
T
(
"Conference speaker is missing"
)
li
.
append
(
text
)
ids
=
duplicate_conference
(
row
.
publication
s
,
row
.
categor
ies
.
usual
==
'proceeding'
)
ids
=
duplicate_conference
(
publication
,
categor
y_
usual
==
'proceeding'
)
if
ids
:
idset
=
idset
.
union
(
ids
)
text
=
T
(
"Possible duplicate entries"
)
li
.
append
(
text
)
# specific fields for report
if
row
.
categor
ies
.
usual
==
'report'
:
if
categor
y_
usual
==
'report'
:
if
not
row
.
publication
s
.
report_numbers
:
if
not
publication
.
report_numbers
:
text
=
T
(
"Report number is missing"
)
li
.
append
(
text
)
ids
=
duplicate_report
(
row
.
publication
s
)
ids
=
duplicate_report
(
publication
)
if
ids
:
idset
=
idset
.
union
(
ids
)
text
=
T
(
"Possible duplicate entries"
)
...
...
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