Fixed CFP state transitions
Change-Id: If054fd822d85301d2d3fe85e7cf6d4c26aa4b381
This commit is contained in:
parent
41f6a421c2
commit
fa90b07484
@ -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
|
||||
*/
|
||||
|
@ -61,6 +61,7 @@ class SpeakerEditPermissionRequest extends SilverstripeBaseModel
|
||||
{
|
||||
parent::__construct();
|
||||
$this->approved = false;
|
||||
$this->hash = "";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -281,7 +281,7 @@ final class PresentationService
|
||||
$presentation->setSelectionPlan($current_selection_plan);
|
||||
|
||||
$summit->addEvent($presentation);
|
||||
|
||||
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
|
||||
|
@ -1697,8 +1697,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->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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user