diff --git a/app/Models/Foundation/Summit/Events/Presentations/Presentation.php b/app/Models/Foundation/Summit/Events/Presentations/Presentation.php index d9503691..2b41b70e 100644 --- a/app/Models/Foundation/Summit/Events/Presentations/Presentation.php +++ b/app/Models/Foundation/Summit/Events/Presentations/Presentation.php @@ -566,6 +566,13 @@ class Presentation extends SummitEvent return $this->progress; } + /** + * @return bool + */ + public function isCompleted():bool { + return $this->progress == Presentation::PHASE_COMPLETE; + } + /** * @param int $progress */ diff --git a/app/Models/Foundation/Summit/Speakers/SpeakerEditPermissionRequest.php b/app/Models/Foundation/Summit/Speakers/SpeakerEditPermissionRequest.php index 7650b370..a0f783fe 100644 --- a/app/Models/Foundation/Summit/Speakers/SpeakerEditPermissionRequest.php +++ b/app/Models/Foundation/Summit/Speakers/SpeakerEditPermissionRequest.php @@ -61,6 +61,7 @@ class SpeakerEditPermissionRequest extends SilverstripeBaseModel { parent::__construct(); $this->approved = false; + $this->hash = ""; } /** diff --git a/app/Services/Model/PresentationService.php b/app/Services/Model/PresentationService.php index 84f7fa89..86a89beb 100644 --- a/app/Services/Model/PresentationService.php +++ b/app/Services/Model/PresentationService.php @@ -281,8 +281,8 @@ final class PresentationService $presentation->setSelectionPlan($current_selection_plan); $summit->addEvent($presentation); - - $presentation->setProgress(Presentation::PHASE_SUMMARY); + if(!$presentation->isCompleted()) + $presentation->setProgress(Presentation::PHASE_SUMMARY); $presentation = $this->saveOrUpdatePresentation ( @@ -447,7 +447,7 @@ final class PresentationService $presentation->clearTags(); if (count($data['tags']) > 0) { - if ($presentation->getProgress() == Presentation::PHASE_SUMMARY) + if(!$presentation->isCompleted()) $presentation->setProgress(Presentation::PHASE_TAGS); } @@ -596,12 +596,6 @@ final class PresentationService $presentation_id )); - if ($presentation->getProgress() != Presentation::PHASE_SPEAKERS) { - throw new ValidationException - ( - sprintf("presentation %s is not allowed to mark as completed", $presentation_id) - ); - } if (!$presentation->fulfilSpeakersConditions()) { throw new ValidationException diff --git a/app/Services/Model/SummitService.php b/app/Services/Model/SummitService.php index 435a1b49..cf9fa4e0 100644 --- a/app/Services/Model/SummitService.php +++ b/app/Services/Model/SummitService.php @@ -1697,9 +1697,8 @@ final class SummitService extends AbstractService implements ISummitService $speaker = $this->speaker_repository->getById(intval($speaker_id)); if (is_null($speaker)) throw new EntityNotFoundException(sprintf('speaker %s not found', $speaker_id)); - - if($presentation->getProgress() == Presentation::PHASE_TAGS) - $presentation->setProgress(Presentation::PHASE_SPEAKERS); + if(!$presentation->isCompleted()) + $presentation->setProgress(Presentation::PHASE_SPEAKERS); $presentation->addSpeaker($speaker); }); @@ -1741,8 +1740,7 @@ final class SummitService extends AbstractService implements ISummitService $speaker = $this->speaker_repository->getById(intval($speaker_id)); if (is_null($speaker)) throw new EntityNotFoundException(sprintf('speaker %s not found', $speaker_id)); - - if($presentation->getProgress() == Presentation::PHASE_TAGS) + if(!$presentation->isCompleted()) $presentation->setProgress(Presentation::PHASE_SPEAKERS); $presentation->removeSpeaker($speaker); @@ -1784,8 +1782,7 @@ final class SummitService extends AbstractService implements ISummitService $speaker = $this->speaker_repository->getById(intval($speaker_id)); if (is_null($speaker)) throw new EntityNotFoundException(sprintf('speaker %s not found', $speaker_id)); - - if($presentation->getProgress() == Presentation::PHASE_TAGS) + if(!$presentation->isCompleted()) $presentation->setProgress(Presentation::PHASE_SPEAKERS); $presentation->setModerator($speaker); @@ -1828,8 +1825,7 @@ final class SummitService extends AbstractService implements ISummitService $speaker = $this->speaker_repository->getById(intval($speaker_id)); if (is_null($speaker)) throw new EntityNotFoundException(sprintf('speaker %s not found', $speaker_id)); - - if($presentation->getProgress() == Presentation::PHASE_TAGS) + if(!$presentation->isCompleted()) $presentation->setProgress(Presentation::PHASE_SPEAKERS); $presentation->unsetModerator();