Commit 2e2cc99d authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Local improvement for speed.

parent 8993142a
......@@ -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)
......
......@@ -23,7 +23,7 @@ def check_publication(row):
Args:
row (gluon.dal.Row): record defining a publication.
Its contains the publications 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.categories.code == UNDEF:
if category_code == UNDEF:
text = T("The category is undefined")
li.append(text)
# team
if row.publications.id_teams == UNDEF_ID:
if publication.id_teams == UNDEF_ID:
text = T("The team is undefined")
li.append(text)
# project
if row.publications.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.publications.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.publications.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.publications.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.publications.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.publications)
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.categories.code in ('ACL', 'ACLN'):
if category_code in ('ACL', 'ACLN'):
if row.publications.id_publishers == UNDEF_ID:
if publication.id_publishers == UNDEF_ID:
text = T("Publishers is not defined")
li.append(text)
if not row.publications.volume:
if not publication.volume:
text = T("Volume number is not defined")
li.append(text)
if not row.publications.pages:
if not publication.pages:
text = T("Pages range is not defined")
li.append(text)
if not row.publications.preprint:
if not publication.preprint:
text = T("Preprint number is not defined")
li.append(text)
ids = duplicate_article(row.publications)
ids = duplicate_article(publication)
if ids:
idset = idset.union(ids)
text = T("Possible duplicate entries")
li.append(text)
# specific fields for preprint
if row.categories.code == 'PRE':
if category_code == 'PRE':
if not row.publications.preprint:
if not publication.preprint:
text = T("Preprint number is not defined")
li.append(text)
# specific fields for proceeding and talk
if row.categories.usual in ('proceeding', 'talk'):
if category_usual in ('proceeding', 'talk'):
if not row.publications.conference_title:
if not publication.conference_title:
text = T("Conference title is not defined")
li.append(text)
if not row.publications.conference_dates:
if not publication.conference_dates:
text = T("Conference dates is not defined")
li.append(text)
if not row.publications.conference_town:
if not publication.conference_town:
text = T("Conference town is not defined")
li.append(text)
if not row.publications.id_countries:
if not publication.id_countries:
text = T("Conference country is not defined")
li.append(text)
if not row.publications.conference_speaker:
if not publication.conference_speaker:
text = T("Conference speaker is missing")
li.append(text)
ids = duplicate_conference(row.publications,
row.categories.usual == 'proceeding')
ids = duplicate_conference(publication,
category_usual == 'proceeding')
if ids:
idset = idset.union(ids)
text = T("Possible duplicate entries")
li.append(text)
# specific fields for report
if row.categories.usual == 'report':
if category_usual == 'report':
if not row.publications.report_numbers:
if not publication.report_numbers:
text = T("Report number is missing")
li.append(text)
ids = duplicate_report(row.publications)
ids = duplicate_report(publication)
if ids:
idset = idset.union(ids)
text = T("Possible duplicate entries")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment