Gitlab CSE Unil
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
M. Chardon
moodle-assignfeedback_editpdfplus
Commits
7a004a49
Commit
7a004a49
authored
Aug 13, 2019
by
M. Chardon
Browse files
maj conversion task
parent
f2d34b1b
Changes
1
Hide whitespace changes
Inline
Side-by-side
classes/task/convert_submissions.php
View file @
7a004a49
...
@@ -58,15 +58,21 @@ class convert_submissions extends scheduled_task {
...
@@ -58,15 +58,21 @@ class convert_submissions extends scheduled_task {
$assignmentcache
=
array
();
$assignmentcache
=
array
();
$conversionattemptlimit
=
!
empty
(
$CFG
->
conversionattemptlimit
)
?
$CFG
->
conversionattemptlimit
:
3
;
foreach
(
$records
as
$record
)
{
foreach
(
$records
as
$record
)
{
$submissionid
=
$record
->
submissionid
;
$submissionid
=
$record
->
submissionid
;
$submission
=
$DB
->
get_record
(
'assign_submission'
,
array
(
'id'
=>
$submissionid
),
'*'
,
IGNORE_MISSING
);
$submission
=
$DB
->
get_record
(
'assign_submission'
,
array
(
'id'
=>
$submissionid
),
'*'
,
IGNORE_MISSING
);
if
(
!
$submission
)
{
if
(
!
$submission
||
$record
->
attemptedconversions
>=
$conversionattemptlimit
)
{
// Submission no longer exists.
// Submission no longer exists
; or we've exceeded the conversion attempt limit
.
$DB
->
delete_records
(
'assignfeedback_editpp_queue'
,
array
(
'id'
=>
$record
->
id
));
$DB
->
delete_records
(
'assignfeedback_editpp_queue'
,
array
(
'id'
=>
$record
->
id
));
continue
;
continue
;
}
}
// Record that we're attempting the conversion ahead of time.
// We can't do this afterwards as its possible for the conversion process to crash the script entirely.
$DB
->
set_field
(
'assignfeedback_editpp_queue'
,
'attemptedconversions'
,
$record
->
attemptedconversions
+
1
,
[
'id'
=>
$record
->
id
]);
$assignmentid
=
$submission
->
assignment
;
$assignmentid
=
$submission
->
assignment
;
$attemptnumber
=
$record
->
submissionattempt
;
$attemptnumber
=
$record
->
submissionattempt
;
...
@@ -96,13 +102,12 @@ class convert_submissions extends scheduled_task {
...
@@ -96,13 +102,12 @@ class convert_submissions extends scheduled_task {
foreach
(
$users
as
$userid
)
{
foreach
(
$users
as
$userid
)
{
try
{
try
{
$combineddocument
=
document_services
::
get_combined_pdf_for_attempt
(
$assignment
,
$userid
,
$attemptnumber
);
$combineddocument
=
document_services
::
get_combined_pdf_for_attempt
(
$assignment
,
$userid
,
$attemptnumber
);
$status
=
$combineddocument
->
get_status
();
switch
(
$combineddocument
->
get_status
())
{
switch
(
$combineddocument
->
get_status
())
{
case
combined_document
::
STATUS_READY
:
case
combined_document
::
STATUS_READY
:
case
combined_document
::
STATUS_READY_PARTIAL
:
case
combined_document
::
STATUS_PENDING_INPUT
:
case
combined_document
::
STATUS_PENDING_INPUT
:
// The document has not been converted yet or is somehow still ready.
// The document has not been converted yet or is somehow still ready.
continue
;
continue
2
;
}
}
document_services
::
get_page_images_for_attempt
(
document_services
::
get_page_images_for_attempt
(
$assignment
,
$userid
,
$attemptnumber
,
false
$assignment
,
$userid
,
$attemptnumber
,
false
...
...
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