Updates for CFP
* mark presentation as complete only if fulfil speakers requirements Change-Id: Ie50c3f931ff28cea019e5a5645d0bcacfb62f90b
This commit is contained in:
parent
ba56571773
commit
a8986736ba
|
@ -724,4 +724,30 @@ class Presentation extends SummitEvent
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function fulfilSpeakersConditions(): bool {
|
||||||
|
$type = $this->type;
|
||||||
|
if(!$type instanceof PresentationType) return false;
|
||||||
|
|
||||||
|
if($type->isUseModerator()){
|
||||||
|
$count = $this->getModeratorId() > 0 ? 1 : 0;
|
||||||
|
$max = $type->getMaxModerators();
|
||||||
|
$min = $type->getMinModerators();
|
||||||
|
if($type->isModeratorMandatory() && $min > $count) return false;
|
||||||
|
if( $count > $max ) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($type->isUseSpeakers()){
|
||||||
|
$count = $this->speakers->count();
|
||||||
|
$max = $type->getMaxSpeakers();
|
||||||
|
$min = $type->getMinSpeakers();
|
||||||
|
if($type->isAreSpeakersMandatory() && $min > $count) return false;
|
||||||
|
if( $count > $max ) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -410,7 +410,7 @@ final class PresentationService
|
||||||
$presentation->setType($event_type);
|
$presentation->setType($event_type);
|
||||||
$presentation->setCategory($track);
|
$presentation->setCategory($track);
|
||||||
// add me as speaker
|
// add me as speaker
|
||||||
$presentation->addSpeaker($current_speaker);
|
//$presentation->addSpeaker($current_speaker);
|
||||||
|
|
||||||
if (isset($data['tags'])) {
|
if (isset($data['tags'])) {
|
||||||
$presentation->clearTags();
|
$presentation->clearTags();
|
||||||
|
@ -565,6 +565,13 @@ final class PresentationService
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$presentation->fulfilSpeakersConditions()) {
|
||||||
|
throw new ValidationException
|
||||||
|
(
|
||||||
|
sprintf("presentation %s is not allowed to mark as completed because does not fulfil speakers conditions", $presentation_id)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$title = $presentation->getTitle();
|
$title = $presentation->getTitle();
|
||||||
$abtract = $presentation->getAbstract();
|
$abtract = $presentation->getAbstract();
|
||||||
$level = $presentation->getLevel();
|
$level = $presentation->getLevel();
|
||||||
|
|
Loading…
Reference in New Issue