diff --git a/hypha/apply/review/views.py b/hypha/apply/review/views.py index 06526cf6863c8dcbd92d7ac6399aa517cb7f33f1..459a3806f33e40fcf4ea398f9eb21d6f603db422 100644 --- a/hypha/apply/review/views.py +++ b/hypha/apply/review/views.py @@ -1,3 +1,4 @@ +from django.conf import settings from django.contrib.auth.decorators import login_required from django.contrib.auth.mixins import UserPassesTestMixin from django.core.exceptions import PermissionDenied @@ -184,6 +185,7 @@ class ReviewCreateOrUpdateView(BaseStreamForm, CreateOrUpdateView): def review_workflow_actions(request, submission): submission_stepped_phases = submission.workflow.stepped_phases + transition_after = settings.TRANSITION_AFTER_REVIEWS action = None if submission.status == INITIAL_STATE: # Automatically transition the application to "Internal review". @@ -191,16 +193,16 @@ def review_workflow_actions(request, submission): elif submission.status == 'proposal_discussion': # Automatically transition the proposal to "Internal review". action = 'proposal_internal_review' - elif submission.status == submission_stepped_phases[2][0].name and submission.reviews.count() > 1: + elif transition_after and submission.status == submission_stepped_phases[2][0].name and submission.reviews.count() >= transition_after: # Automatically transition the application to "Ready for discussion". action = submission_stepped_phases[3][0].name - elif submission.status == 'ext_external_review' and submission.reviews.by_reviewers().count() > 1: + elif transition_after and submission.status == 'ext_external_review' and submission.reviews.by_reviewers().count() >= transition_after: # Automatically transition the application to "Ready for discussion". action = 'ext_post_external_review_discussion' - elif submission.status == 'com_external_review' and submission.reviews.by_reviewers().count() > 1: + elif transition_after and submission.status == 'com_external_review' and submission.reviews.by_reviewers().count() >= transition_after: # Automatically transition the application to "Ready for discussion". action = 'com_post_external_review_discussion' - elif submission.status == 'external_review' and submission.reviews.by_reviewers().count() > 1: + elif transition_after and submission.status == 'external_review' and submission.reviews.by_reviewers().count() >= transition_after: # Automatically transition the proposal to "Ready for discussion". action = 'post_external_review_discussion' diff --git a/hypha/settings/base.py b/hypha/settings/base.py index a6e835ec39bbdcf330f8f4db19bcd17185258da0..1473cda4d2e479f1666efceffc05c723ac9615c0 100644 --- a/hypha/settings/base.py +++ b/hypha/settings/base.py @@ -320,7 +320,10 @@ AUTH_PASSWORD_VALIDATORS = [ # Number of days that password reset and account activation links are valid (default 3). if 'PASSWORD_RESET_TIMEOUT_DAYS' in env: - PASSWORD_RESET_TIMEOUT_DAYS = int(env['PASSWORD_RESET_TIMEOUT_DAYS']) + try: + PASSWORD_RESET_TIMEOUT_DAYS = int(env['PASSWORD_RESET_TIMEOUT_DAYS']) + except ValueError: + pass # Internationalization # https://docs.djangoproject.com/en/stable/topics/i18n/ @@ -565,6 +568,15 @@ else: SLACK_TYPE_COMMENTS = [] +# Automatic transition settings +TRANSITION_AFTER_REVIEWS = False +if 'TRANSITION_AFTER_REVIEWS' in env: + try: + TRANSITION_AFTER_REVIEWS = int(env['TRANSITION_AFTER_REVIEWS']) + except ValueError: + pass + + # Celery config if 'REDIS_URL' in env: CELERY_BROKER_URL = env.get('REDIS_URL') diff --git a/hypha/settings/test.py b/hypha/settings/test.py index 610dc3b03352a6d17bfd0d2b6365675a515d929b..6e165d3bd5e0cd4a24ecb004b3c27a54d7496bf9 100644 --- a/hypha/settings/test.py +++ b/hypha/settings/test.py @@ -12,6 +12,8 @@ SECRET_KEY = 'NOT A SECRET' PROJECTS_ENABLED = True PROJECTS_AUTO_CREATE = True +TRANSITION_AFTER_REVIEWS = 2 + STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage' PASSWORD_HASHERS = [