Skip to content

Commit

Permalink
Add new workflow for Request With Review
Browse files Browse the repository at this point in the history
This workflow is like Request with External Review, in that both
internal and external reviewers can review submissions.  However, it has
a workflow more like Request in that there is only one Review step.
  • Loading branch information
frankduncan committed Oct 26, 2024
1 parent 75ec0a5 commit 814eb99
Show file tree
Hide file tree
Showing 2 changed files with 215 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Generated by Django 4.2.16 on 2024-10-26 13:14

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("funds", "0120_applicationsubmission_public_id_and_more"),
]

operations = [
migrations.AlterField(
model_name="applicationbase",
name="workflow_name",
field=models.CharField(
choices=[
("single", "Request"),
("single_rev", "Request with review"),
("single_ext", "Request with external review"),
("single_com", "Request with community review"),
("double", "Concept & Proposal"),
],
default="single",
max_length=100,
verbose_name="Workflow",
),
),
migrations.AlterField(
model_name="applicationsubmission",
name="workflow_name",
field=models.CharField(
choices=[
("single", "Request"),
("single_rev", "Request with review"),
("single_ext", "Request with external review"),
("single_com", "Request with community review"),
("double", "Concept & Proposal"),
],
default="single",
max_length=100,
verbose_name="Workflow",
),
),
migrations.AlterField(
model_name="labbase",
name="workflow_name",
field=models.CharField(
choices=[
("single", "Request"),
("single_rev", "Request with review"),
("single_ext", "Request with external review"),
("single_com", "Request with community review"),
("double", "Concept & Proposal"),
],
default="single",
max_length=100,
verbose_name="Workflow",
),
),
migrations.AlterField(
model_name="roundbase",
name="workflow_name",
field=models.CharField(
choices=[
("single", "Request"),
("single_rev", "Request with review"),
("single_ext", "Request with external review"),
("single_com", "Request with community review"),
("double", "Concept & Proposal"),
],
default="single",
max_length=100,
verbose_name="Workflow",
),
),
]
140 changes: 139 additions & 1 deletion hypha/apply/funds/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ def make_permissions(edit=None, review=None, view=None):

Request = Stage("Request", False)

RequestRev = Stage("RequestRev", True)

RequestExt = Stage("RequestExt", True)

RequestCom = Stage("RequestCom", True)
Expand Down Expand Up @@ -380,6 +382,134 @@ def make_permissions(edit=None, review=None, view=None):
},
]

SingleStageReviewDefinition = [
{
DRAFT_STATE: {
"transitions": {
INITIAL_STATE: {
"display": _("Submit"),
"permissions": {UserPermissions.APPLICANT},
"method": "create_revision",
},
},
"display": _("Draft"),
"stage": RequestRev,
"permissions": applicant_edit_permissions,
}
},
{
INITIAL_STATE: {
"transitions": {
"rev_more_info": _("Request More Information"),
"rev_review": _("Open Review"),
"rev_determination": _("Ready For Determination"),
"rev_rejected": _("Dismiss"),
},
"display": _("Need screening"),
"public": _("Application Received"),
"stage": RequestRev,
"permissions": default_permissions,
},
"rev_more_info": {
"transitions": {
INITIAL_STATE: {
"display": _("Submit"),
"permissions": {
UserPermissions.APPLICANT,
UserPermissions.STAFF,
UserPermissions.LEAD,
UserPermissions.ADMIN,
},
"method": "create_revision",
},
},
"display": _("More information required"),
"stage": RequestRev,
"permissions": applicant_edit_permissions,
},
},
{
"rev_review": {
"transitions": {
"rev_post_review_discussion": _("Close Review"),
INITIAL_STATE: _("Need screening (revert)"),
},
"display": _("Internal Review"),
"public": _("{org_short_name} Review").format(
org_short_name=settings.ORG_SHORT_NAME
),
"stage": RequestRev,
"permissions": reviewer_review_permissions,
},
},
{
"rev_post_review_discussion": {
"transitions": {
"rev_post_review_more_info": _("Request More Information"),
"rev_determination": _("Ready For Determination"),
"rev_review": _("Open Review (revert)"),
"rev_rejected": _("Dismiss"),
},
"display": _("Ready For Discussion"),
"stage": RequestRev,
"permissions": hidden_from_applicant_permissions,
},
"rev_post_review_more_info": {
"transitions": {
"rev_post_review_discussion": {
"display": _("Submit"),
"permissions": {
UserPermissions.APPLICANT,
UserPermissions.STAFF,
UserPermissions.LEAD,
UserPermissions.ADMIN,
},
"method": "create_revision",
},
},
"display": _("More information required"),
"stage": RequestRev,
"permissions": applicant_edit_permissions,
},
},
{
"rev_determination": {
"transitions": {
"rev_post_review_discussion": _("Ready For Discussion (revert)"),
"rev_almost": _("Accept but additional info required"),
"rev_accepted": _("Accept"),
"rev_rejected": _("Dismiss"),
},
"display": _("Ready for Determination"),
"permissions": hidden_from_applicant_permissions,
"stage": RequestRev,
},
},
{
"rev_accepted": {
"display": _("Accepted"),
"future": _("Application Outcome"),
"stage": RequestRev,
"permissions": staff_edit_permissions,
},
"rev_almost": {
"transitions": {
"rev_accepted": _("Accept"),
"rev_post_review_discussion": _("Ready For Discussion (revert)"),
},
"display": _("Accepted but additional info required"),
"stage": RequestRev,
"permissions": applicant_edit_permissions,
},
"rev_rejected": {
"display": _("Dismissed"),
"stage": RequestRev,
"permissions": no_permissions,
},
},
]


SingleStageExternalDefinition = [
{
DRAFT_STATE: {
Expand Down Expand Up @@ -1085,6 +1215,12 @@ def phase_data(phases):

Request = Workflow("Request", "single", **phase_data(SingleStageDefinition))

RequestReview = Workflow(
"Request with review",
"single_rev",
**phase_data(SingleStageReviewDefinition),
)

RequestExternal = Workflow(
"Request with external review",
"single_ext",
Expand All @@ -1104,6 +1240,7 @@ def phase_data(phases):

WORKFLOWS = {
Request.admin_name: Request,
RequestReview.admin_name: RequestReview,
RequestExternal.admin_name: RequestExternal,
RequestCommunity.admin_name: RequestCommunity,
ConceptProposal.admin_name: ConceptProposal,
Expand Down Expand Up @@ -1226,6 +1363,7 @@ def get_dismissed_statuses():
DETERMINATION_RESPONSE_PHASES = [
"post_review_discussion",
"concept_review_discussion",
"rev_post_review_discussion",
"post_external_review_discussion",
"ext_post_external_review_discussion",
"com_post_external_review_discussion",
Expand Down Expand Up @@ -1285,7 +1423,7 @@ def phases_matching(phrase, exclude=None):
},
"internal-review": {
"name": _("Internal Review"),
"statuses": phases_matching("internal_review"),
"statuses": phases_matching("rev_review") + phases_matching("internal_review"),
},
"in-discussion": {
"name": _("Ready for Discussion"),
Expand Down

0 comments on commit 814eb99

Please sign in to comment.