feat: rename project statuses

This commit is contained in:
2025-11-13 15:19:55 +01:00
parent 02cc142767
commit 3ef2c11b2e
8 changed files with 57 additions and 32 deletions
@@ -148,7 +148,7 @@ class ProjectApiResource
*/
#[API\ApiFilter(filterClass: SearchFilter::class, strategy: 'exact')]
#[API\ApiProperty(securityPostDenormalize: 'is_granted("PROJECT_EDIT", previous_object)')]
public ProjectStatus $status = ProjectStatus::InEditing;
public ProjectStatus $status = ProjectStatus::InDraft;
/**
* List of the ProjectRewards this Project offers.
+7 -7
View File
@@ -50,12 +50,12 @@ class ProjectsPump implements PumpInterface
}
$status = $this->getProjectStatus($record);
if (\in_array($status, [ProjectStatus::Rejected])) {
if (\in_array($status, [ProjectStatus::CampaignReviewRejected])) {
return;
}
$created = new \DateTime($record['created']);
if (\in_array($status, [ProjectStatus::InDraft, ProjectStatus::InEditing]) && $created < new \DateTime('2024-01-01')) {
if (\in_array($status, [ProjectStatus::InDraft, ProjectStatus::InDraft]) && $created < new \DateTime('2024-01-01')) {
return;
}
@@ -167,19 +167,19 @@ class ProjectsPump implements PumpInterface
{
switch ($record['status']) {
case 1:
return ProjectStatus::InEditing;
return ProjectStatus::InDraft;
case 2:
return ProjectStatus::InReview;
return ProjectStatus::InCampaignReview;
case 3:
return ProjectStatus::InCampaign;
case 6:
return ProjectStatus::Unfunded;
return ProjectStatus::CampaignFailed;
case 4:
case 5:
return ProjectStatus::Funded;
return ProjectStatus::FundingPaid;
case 0:
default:
return ProjectStatus::Rejected;
return ProjectStatus::CampaignReviewRejected;
}
}
+1 -1
View File
@@ -109,7 +109,7 @@ class Project implements UserOwnedInterface, AccountingOwnerInterface, Localized
* Projects have a start and an end, and in the meantime they go through different phases represented under this status.
*/
#[ORM\Column(type: 'string', enumType: ProjectStatus::class)]
private ProjectStatus $status = ProjectStatus::InEditing;
private ProjectStatus $status = ProjectStatus::InDraft;
/**
* @var Collection<int, Reward>
+40 -15
View File
@@ -13,47 +13,72 @@ enum ProjectStatus: string
case InDraft = 'in_draft';
/**
* Owner finished editing and Project is ready for review.
* Owner finished editing and Project is ready for campaign review.
*/
case ToReview = 'to_review';
case ToCampaignReview = 'to_campaign_review';
/**
* An admin is reviewing the Project.
* A reviewer is reviewing the Project for campaign.
*/
case InReview = 'in_review';
case InCampaignReview = 'in_campaign_review';
/**
* Admin asked for changes and the Project is under edition by it's owner.
* Owner requested to do changes by the campaign reviewer.
*/
case InEditing = 'in_editing';
case InCampaignReviewRequestChange = 'in_campaign_review.request_change';
/**
* An admin reviewed it and rejected it. Final.
* Project is KO for campaign by the reviewer, final.
*/
case Rejected = 'rejected';
case CampaignReviewRejected = 'campaign_review.rejected';
/**
* An admin reviewed it and deemed worthy to campaign.
* Project is OK for campaign by the reviewer, can move forward.
*/
case ToCampaign = 'to_campaign';
/**
* Project was reviewed and is in campaign for funding.
* Project is in live campaign and raising funds.
*/
case InCampaign = 'in_campaign';
/**
* Project finished campaigning but didn't meet funding goals. Final.
* Project failed to raise enough funds, final.
*/
case Unfunded = 'unfunded';
case CampaignFailed = 'campaign.failed';
/**
* Project successfully finished campaigning and owner can receive funds.
* Project raised enough funds, can move forward.
*/
case ToFundingReview = 'to_funding_review';
/**
* Project is under financial review.
*/
case InFundingReview = 'in_funding_review';
/**
* Owner requested to do changes by the financial reviewer.
*/
case InFundingReviewRequestChange = 'in_funding_review.request_change';
/**
* Project is KO for funding by the reviewer, final.
*/
case FundinReviewRejected = 'funding_review.rejected';
/**
* Project is OK for funding by the reviewer, can move forward.
*/
case ToFunding = 'to_funding';
/**
* Project is being funded.
*/
case InFunding = 'in_funding';
/**
* Project owner received all raised funds. Final.
* Project's funds were paid. Final.
*/
case Funded = 'funded';
case FundingPaid = 'funding.paid';
}
+1 -1
View File
@@ -44,7 +44,7 @@ final class ProjectFactory extends PersistentProxyObjectFactory
'description' => '',
'territory' => new Territory('ES'),
'owner' => new User(),
'status' => ProjectStatus::InEditing,
'status' => ProjectStatus::InDraft,
'subtitle' => 'Subtitle',
'title' => 'Title',
];
+5 -5
View File
@@ -120,7 +120,7 @@ class GetAllTest extends ProjectTestCase
public function testGetCollection(): void
{
$status = ProjectStatus::InEditing;
$status = ProjectStatus::InDraft;
$attributes = [
'title' => 'Test Project',
'status' => $status,
@@ -247,18 +247,18 @@ class GetAllTest extends ProjectTestCase
public function testGetAllByStatusInEditing()
{
$this->testGetAllByParam('status', ProjectStatus::InEditing, ProjectStatus::InCampaign);
$this->testGetAllByParam('status', ProjectStatus::InDraft, ProjectStatus::InCampaign);
}
public function testGetAllByStatusFulfilled()
{
$this->testGetAllByParam('status', ProjectStatus::Funded, ProjectStatus::InCampaign);
$this->testGetAllByParam('status', ProjectStatus::FundingPaid, ProjectStatus::InCampaign);
}
public function testGetAllByStatusList()
{
$searchValues = [ProjectStatus::InCampaign, ProjectStatus::Funded];
$this->testGetAllByParamList('status', $searchValues, ProjectStatus::Rejected);
$searchValues = [ProjectStatus::InCampaign, ProjectStatus::FundingPaid];
$this->testGetAllByParamList('status', $searchValues, ProjectStatus::CampaignReviewRejected);
}
public function testGetAllByPartialDescription()
+1 -1
View File
@@ -72,7 +72,7 @@ class GetOneTest extends ProjectTestCase
public function testGetOneFilteredByStatusFunded(): void
{
$this->testGetOneFilteredByStatus(ProjectStatus::Funded);
$this->testGetOneFilteredByStatus(ProjectStatus::FundingPaid);
}
public function testGetOneUnauthorized(): void
+1 -1
View File
@@ -47,7 +47,7 @@ class ProjectCalendarTest extends ApiTestCase
$project->setDescription('Test Project Description');
$project->setTerritory(new Territory('ES'));
$project->setOwner($this->owner);
$project->setStatus(ProjectStatus::InReview);
$project->setStatus(ProjectStatus::InCampaignReview);
return $project;
}