Set ebook placeholders to not be in progress when a project is marked as abandoned

This commit is contained in:
Alex Cabal 2024-12-16 23:54:40 -06:00
parent 97021ce26d
commit 28b7384769
2 changed files with 32 additions and 0 deletions

View file

@ -65,6 +65,17 @@ foreach($projects as $project){
// A stalled `Project` is now abandoned.
$project->Status = Enums\ProjectStatusType::Abandoned;
// Set the corresponding `EbookPlaceholder` to not be "in progress" any more.
if($project->Ebook->EbookPlaceholder !== null){
try{
$project->Ebook->EbookPlaceholder->IsInProgress = false;
$project->Ebook->EbookPlaceholder->Save();
}
catch(Exceptions\InvalidEbookPlaceholderException){
// Pass.
}
}
// Send a notification to the producer.
$project->SendReminder(Enums\ProjectReminderType::Abandoned);
}