Hello again, (I'm getting dizzy after so much code reading)
I've just realised that sbmSUBMISSION is only populated by
websubmit_dblayer.py and never touched by any of the websubmit
functions!
This is OK for simple documents, but for refereed documents that were
approved/rejected, document status for submitter/action Approve always
remains 'pending'.
BTW, the status in sbmAPPROVAL table is updated alright (by
Update_Approval_DB), but the 'pending' in sbmSUBMISSION results in a
confusing line in 'your submissions' page that says "Approve Record",
status "pending".
Here are some lines from the two tables for "IKEEART-2009-051" that is
already approved
([email protected]:referee, [email protected]:submitter):
sbmSUBMISSION:
[email protected] IKEEART SBI finished 1233858287_8848
IKEEART-2009-051 2009-02-05 20:24:48 2009-02-05 21:33:26
[email protected] IKEEART APP pending 1233862449_26559
IKEEART-2009-051 2009-02-05 21:34:09 2009-02-05 21:34:09
sbmAPPROVAL:
IKEEART ART IKEEART-2009-051 approved 2009-02-05 21:33:26
2009-02-05 21:33:26 2009-02-05 21:34:21 1233862406.4226561
The solution is simple and involves updating the status of action APP
in sbmSUBMISSION to "finished", probably by Update_Approval_DB.
I believe that something like this should do the trick:
if decision == "approve":
run_sql("UPDATE sbmAPPROVAL SET
dAction=NOW(),status='approved' WHERE rn=%s", (rn,))
run_sql("UPDATE sbmSUBMISSION SET
md=NOW(),status='finished' WHERE rn=%s and action='APP'", (rn,))
else:
run_sql("UPDATE sbmAPPROVAL SET
dAction=NOW(),status='rejected' WHERE rn=%s", (rn,))
# Still the 'APP' phase is 'finished'
run_sql("UPDATE sbmSUBMISSION SET
md=NOW(),status='finished' WHERE rn=%s and action='APP'", (rn,))
# But the document was rejected...
# And submitter has still SBI 'finished' in "Your
submissions" # (and so was given a reference number...
That now points to nowhere)
# We must somehow remind him that although his submission
was finished, it was finally rejected:
# ("Your submissions" page doesn't read the sbmAPPROVAL table)
run_sql("UPDATE sbmSUBMISSION SET
md=NOW(),status='rejected' WHERE rn=%s and action='SBI'", (rn,))
return ""