Commit 0dc9c81e authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Finalise the wizard check and validate.

parent 6d50b326
......@@ -5,9 +5,12 @@ import re
from gluon.storage import Storage
from harvest_tools import DRY_RUN
from plugin_dbui import Selector
DRY_RUN = T(DRY_RUN)
MSG_NO_AUTHORS = "<br><br>Removing affiliation failed.<br>"\
"Use INSPIRES instead with the tool 'insert MARCXML'"
......@@ -23,7 +26,7 @@ def check_validate():
id_ok = db(db.status.code=='OK').select().first().id
# select rows according to user requirements
selector = Selector(virtdb.check_selector, exclude_fields=('validate'))
selector = Selector(virtdb.check_selector, exclude_fields=('mode'))
rows = selector.select(db.publications,
orderby=(db.projects.project, db.categories.code))
......@@ -105,9 +108,8 @@ def check_validate():
nvalidated += 1
del logs[-1]
if selector.validate:
# row.publications.update_record(id_status=id_ok)
pass
if selector.mode != DRY_RUN:
row.publications.update_record(id_status=id_ok)
return dict(logs=logs,
nfound=nfound,
......
......@@ -58,7 +58,9 @@
'Category Codes': 'Code des catégories',
'Catégories': 'Catégories',
'Change password': 'Change password',
'change status': 'modifie le status',
'Chapter(s)': 'Chaptitre(s)',
'Check and validate': 'Vérifier et valider',
'check and validate': 'vérifier et valider',
'Check latex syntax': 'Vérifier la syntaxe latex',
'Check to delete': 'Check to delete',
......@@ -158,6 +160,7 @@
'invalid expression': 'expression invalide',
'Invalid login': 'Invalid login',
'Invalid password': 'Invalid password',
'Invalid records': 'Enregistrements non valide',
'Is Active': 'Is Active',
'is equal to': 'est égal à',
'ISBN': 'ISBN',
......@@ -209,10 +212,11 @@
'Notes and reports to committees': 'Notes et Rapports à des Comités',
'Notes and Reports to Committees': 'Notes et Rapports à des Comités',
'Number for the first pages or a range 69-80': 'Numéro de la première page ou un range 69-80',
'Number of invalid records: %s': 'Number of invalid records: %s',
'Number of records already validated: %s': 'Number of records already validated: %s',
'Number of invalid records: %s': "Nombre d'enregistrement non valide : %s",
'Number of records already validated: %s': "Nombre d'enregistrements déjà validé : %s",
'Number of records found: %s': "Nombre d'enregistrements trouvés : %s",
'Number of records inserted in the database: %s': "Nombre d'enregistrements ajoutés à la base de donnée : %s",
'Number of records validated: %s': "Nombre d'enregistrements validé : %s",
'Number(s)': 'Numéro(s)',
'Object or table name': 'Object or table name',
'Old password': 'Old password',
......
......@@ -11,6 +11,7 @@
import harvest_tools
MODE_DRY_RUN = T(harvest_tools.DRY_RUN)
MODE_CHANGE_STATUS = T('change status')
MODE_LOAD_IN_DB = T('load in the database')
virtdb = DAL(None)
......@@ -36,7 +37,7 @@ virtdb.define_table('check_selector',
Field('id_teams', db.teams, label='Team'),
Field('id_projects', db.projects, label='Project'),
Field('id_categories', db.categories, label='Category'),
Field('validate', 'boolean', default=False))
Field('mode', 'string', default=MODE_DRY_RUN))
virtdb.check_selector.id_categories.requires = \
IS_IN_DB(db, 'categories.id', 'categories.code')
......@@ -47,6 +48,9 @@ IS_IN_DB(db, 'projects.id', 'projects.project')
virtdb.check_selector.id_teams.requires = \
IS_IN_DB(db, 'teams.id', 'teams.team')
virtdb.check_selector.mode.requires = \
IS_IN_SET([MODE_DRY_RUN, MODE_CHANGE_STATUS])
#
# free harvesters selector
#
......
......@@ -48,7 +48,7 @@
#
# Header
#
response.write(myp_smallcap("Check and validate"))
response.write(myp_smallcap(T("Check and validate")))
#
# Scanning condition and results
......@@ -61,6 +61,9 @@
txt = T("Number of records already validated: %s") % nok
ul.append(myli(txt))
txt = T("Number of records validated: %s") % nvalidated
ul.append(myli(txt))
txt = T("Number of invalid records: %s") % (nfound - nok - nvalidated)
ul.append(myli(txt))
......@@ -70,7 +73,7 @@
# Log
#
response.write(BR())
response.write(myp_smallcap("Invalid records"))
response.write(myp_smallcap(T("Invalid records")))
ol = myol()
for msg in logs:
......
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