Commit 8993142a authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Better implementation of the fix for duplicate_conference.

parent 661debf1
......@@ -157,7 +157,7 @@ def INHIBIT_DUPLICATE_PUBLICATION(publication):
get_id(db.categories, code='COM'))
if id_category in id_cats:
ids = duplicate_conference(publication)
ids = duplicate_conference(publication, id_category != id_cats[2])
if ids:
db.publications[CALLBACK_ERRORS] = [
......
......@@ -8,7 +8,6 @@ import regex
from gluon import current
from plugin_dbui import (UNDEF,
UNDEF_ID,
get_id,
get_where_query)
......@@ -166,7 +165,8 @@ def check_publication(row):
text = T("Conference speaker is missing")
li.append(text)
ids = duplicate_conference(row.publications)
ids = duplicate_conference(row.publications,
row.categories.usual == 'proceeding')
if ids:
idset = idset.union(ids)
text = T("Possible duplicate entries")
......@@ -262,7 +262,7 @@ def duplicate_article(publication):
return ids
def duplicate_conference(publication):
def duplicate_conference(publication, proceeding=False):
"""Look for duplicate talk / proceeding.
The comparison is performed on conference talk/proceeding published
......@@ -275,6 +275,7 @@ def duplicate_conference(publication):
Args:
publication (dict or gluon.storage.Storage): contains the publication
fields and theirs values.
proceeding (bool): tag the publication either as talk or a proceeding.
Returns:
list: list of *ids* corresponding to duplicate entries.
......@@ -286,11 +287,11 @@ def duplicate_conference(publication):
categories = db.categories
publications = db.publications
if publications.id_categories == get_id(db.categories, code='COM'):
qcat = categories.code == 'COM'
if proceeding:
qcat = (categories.code == 'ACTI') | (categories.code == 'ACTN')
else:
qcat = (categories.code == 'ACTI') | (categories.code == 'ACTN')
qcat = categories.code == 'COM'
qmain = get_where_query(publications)
qmain &= qcat
......
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