Skip to content

Commit

Permalink
Merge pull request #345 from Opencast-Moodle/fix/waitforduplicatework…
Browse files Browse the repository at this point in the history
…flow

include event to wait for response of duplication workflow
  • Loading branch information
NinaHerrmann authored Nov 16, 2023
2 parents 4f3a315 + f07cc41 commit 664c720
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
8 changes: 8 additions & 0 deletions classes/task/process_duplicated_event_visibility_change.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ public function execute() {
throw new \moodle_exception('error_duplicated_event_id_not_ready', 'block_opencast', '', $a);
}

// Ensure video processing is finished and no other workflow is running.
$event = $apibridge->get_already_existing_event([$data->duplicatedeventid]);
if (!$event || !in_array($event->status, ['EVENTS.EVENTS.STATUS.PROCESSED', 'EVENTS.EVENTS.STATUS.PROCESSING_FAILURE'])
|| count($event->publication_status) == 0
|| count($event->publication_status) == 1 && $event->publication_status[0] === 'internal') {
throw new \moodle_exception('error_duplicated_event_id_not_ready', 'block_opencast', '', $a);
}

// Adopting the visibility.
$visiblitychangestatus = $apibridge->set_duplicated_event_visibility(
$data->duplicatedeventid,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"resource": "/api/events/45fca7d0-c1e2-4601-bf12-6ccb3376a5f6",
"body": {
"identifier": "45fca7d0-c1e2-4601-bf12-6ccb3376a5f6",
"creator": "",
"presenter": [],
"created": "2021-08-11T09:32:00Z",
"is_part_of": "84bab8de-5688-46a1-9af0-5ce9122eeb6a",
"subjects": [],
"start": "2021-08-11T09:32:00Z",
"description": "",
"language": "",
"source": "",
"title": "Test video (copy 1)",
"processing_state": "SUCCEEDED",
"duration": 0,
"license": "",
"archive_version": 5,
"contributor": [],
"series": "Series for import",
"has_previews": false,
"location": "",
"rightsholder": "",
"publication_status": [
"engage-player",
"api",
"annotation"
],
"status": "EVENTS.EVENTS.STATUS.PROCESSED",
"acl": [
{
"allow": true,
"role": "ROLE_ADMIN",
"action": "read"
},
{
"allow": true,
"role": "ROLE_ADMIN",
"action": "write"
},
{
"allow": true,
"role": "206001_Instructor",
"action": "read"
},
{
"allow": true,
"role": "206001_Instructor",
"action": "write"
},
{
"allow": false,
"role": "206001_Learner",
"action": "read"
},
{
"allow": true,
"role": "ROLE_GROUP_MH_DEFAULT_ORG_EXTERNAL_APPLICATIONS",
"action": "read"
},
{
"allow": true,
"role": "ROLE_GROUP_MH_DEFAULT_ORG_EXTERNAL_APPLICATIONS",
"action": "write"
}
]
}
}

0 comments on commit 664c720

Please sign in to comment.