Correctly pull reviewer of active projects

This commit is contained in:
Alex Cabal 2025-01-30 12:44:57 -06:00
parent d942f4642b
commit 6261eee67f
2 changed files with 3 additions and 3 deletions

View file

@ -780,12 +780,12 @@ final class Project{
/** /**
* @throws Exceptions\ProjectNotFoundException If the `Project` can't be found. * @throws Exceptions\ProjectNotFoundException If the `Project` can't be found.
*/ */
public static function GetByIdentifierAndIsInProgress(?string $identifier): Project{ public static function GetByIdentifierAndIsActive(?string $identifier): Project{
if($identifier === null){ if($identifier === null){
throw new Exceptions\ProjectNotFoundException(); throw new Exceptions\ProjectNotFoundException();
} }
return Db::Query('SELECT Projects.* from Ebooks inner join Projects using (EbookId) where Ebooks.Identifier = ? and Projects.Status = ?', [$identifier, Enums\ProjectStatusType::InProgress], Project::class)[0] ?? throw new Exceptions\ProjectNotFoundException(); return Db::Query('SELECT Projects.* from Ebooks inner join Projects using (EbookId) where Ebooks.Identifier = ? and Projects.Status in (?, ?, ?)', [$identifier, Enums\ProjectStatusType::InProgress, Enums\ProjectStatusType::AwaitingReview, Enums\ProjectStatusType::Reviewed], Project::class)[0] ?? throw new Exceptions\ProjectNotFoundException();
} }
/** /**

View file

@ -5,7 +5,7 @@ try{
if($urlPath !== null){ if($urlPath !== null){
$identifier = EBOOKS_IDENTIFIER_PREFIX . trim(str_replace('.', '', $urlPath), '/'); // Contains the portion of the URL (without query string) that comes after `https://standardebooks.org/ebooks/`. $identifier = EBOOKS_IDENTIFIER_PREFIX . trim(str_replace('.', '', $urlPath), '/'); // Contains the portion of the URL (without query string) that comes after `https://standardebooks.org/ebooks/`.
$project = Project::GetByIdentifierAndIsInProgress($identifier); $project = Project::GetByIdentifierAndIsActive($identifier);
} }
else{ else{
$project = Project::Get(HttpInput::Int(GET, 'project-id')); $project = Project::Get(HttpInput::Int(GET, 'project-id'));