Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track 'archived' status on ActiveProject model. Ref #2148 #2149

Merged
merged 7 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ GRADIENT_85 = 'rgba(42, 47, 52, 0.85)'
# maximum number of emails that can be associated to a user model
MAX_EMAILS_PER_USER = 10

# maximum number of active projects that can be created by a submitting author at any time.
# if MAX_SUBMITTABLE_PROJECTS is reached, the user must wait for a project to be archived or published before starting another.
MAX_SUBMITTABLE_PROJECTS = 10

# Max training report size in bytes
MAX_TRAINING_REPORT_UPLOAD_SIZE = 1048576
ENABLE_LIGHTWAVE=True
Expand Down
3 changes: 0 additions & 3 deletions physionet-django/console/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,6 @@ def save(self):
# Reject
if edit_log.decision == 0:
project.reject()
# Have to reload this object which is changed by the reject
# function
edit_log = EditLog.objects.get(id=edit_log.id)
# Resubmit with revisions
elif edit_log.decision == 1:
project.submission_status = SubmissionStatus.NEEDS_RESUBMISSION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</li>

<!-- editor home -->
{% if perms.project.change_activeproject or perms.project.change_publishedproject or perms.project.change_archivedproject %}
{% if perms.project.change_activeproject or perms.project.change_publishedproject %}
<li class="nav-item {% if editor_home %}active{% endif %}" data-toggle="tooltip" data-placement="right">
<a id="nav_editor_home" class="nav-link" href="{% url 'editor_home' %}">
<i class="fa fa-fw fa-book-open"></i>
Expand Down
7 changes: 4 additions & 3 deletions physionet-django/console/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from events.models import EventAgreement
from project.models import (
ActiveProject,
ArchivedProject,
Author,
AuthorInvitation,
License,
Expand Down Expand Up @@ -97,8 +96,10 @@ def test_edit_reject(self):
'data_machine_readable':0, 'reusable':1, 'no_phi':0,
'pn_suitable':1, 'editor_comments':'Just bad.', 'decision':0
})
self.assertTrue(ArchivedProject.objects.filter(slug=project.slug))
self.assertFalse(ActiveProject.objects.filter(slug=project.slug))
self.assertTrue(ActiveProject.objects.filter(slug=project.slug,
submission_status=SubmissionStatus.ARCHIVED))
self.assertFalse(ActiveProject.objects.filter(slug=project.slug,
submission_status=SubmissionStatus.NEEDS_DECISION))

def test_edit(self):
"""
Expand Down
20 changes: 11 additions & 9 deletions physionet-django/console/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
AccessLog,
AccessPolicy,
ActiveProject,
ArchivedProject,
DataAccess,
DUA,
DataAccessRequest,
Expand Down Expand Up @@ -155,7 +154,7 @@ def submitted_projects(request):
messages.success(request, 'The editor has been assigned')

# Submitted projects
projects = ActiveProject.objects.filter(submission_status__gt=SubmissionStatus.UNSUBMITTED).order_by(
projects = ActiveProject.objects.filter(submission_status__gt=SubmissionStatus.ARCHIVED).order_by(
'submission_datetime')
# Separate projects by submission status
# Awaiting editor assignment
Expand Down Expand Up @@ -342,7 +341,8 @@ def edit_submission(request, project_slug, *args, **kwargs):
edit_log.set_quality_assurance_results()
# The original object will be deleted if the decision is reject
if edit_log.decision == 0:
project = ArchivedProject.objects.get(slug=project_slug)
project = ActiveProject.objects.get(slug=project_slug,
submission_status=SubmissionStatus.ARCHIVED)
# Notify the authors
notification.edit_decision_notify(request, project, edit_log)
return render(request, 'console/edit_complete.html',
Expand Down Expand Up @@ -1131,12 +1131,13 @@ def aws_bucket_management(request, project, user):
send_files_to_aws(project.id, verbose_name='AWS - {}'.format(project), creator=user)


@permission_required('project.change_archivedproject', raise_exception=True)
@permission_required('project.change_activeproject', raise_exception=True)
def archived_submissions(request):
"""
List of archived submissions
"""
projects = ArchivedProject.objects.all().order_by('archive_datetime')
projects = ActiveProject.objects.filter(submission_status=SubmissionStatus.ARCHIVED
).order_by('creation_datetime')
projects = paginate(request, projects, 50)
return render(request, 'console/archived_submissions.html',
{'projects': projects, 'archived_projects_nav': True})
Expand Down Expand Up @@ -1231,9 +1232,11 @@ def user_management(request, username):
authors__user=user, submission_status=SubmissionStatus.UNSUBMITTED
).order_by("-creation_datetime")
projects["Submitted"] = ActiveProject.objects.filter(
authors__user=user, submission_status__gt=SubmissionStatus.UNSUBMITTED
authors__user=user, submission_status__gt=SubmissionStatus.ARCHIVED
).order_by("-submission_datetime")
projects['Archived'] = ArchivedProject.objects.filter(authors__user=user).order_by('-archive_datetime')
projects['Archived'] = ActiveProject.objects.filter(authors__user=user,
submission_status=SubmissionStatus.ARCHIVED
).order_by('-creation_datetime')
projects['Published'] = PublishedProject.objects.filter(authors__user=user).order_by('-publish_datetime')

credentialing_app = CredentialApplication.objects.filter(user=user).order_by("application_datetime")
Expand Down Expand Up @@ -2159,8 +2162,7 @@ def credentialing_stats(request):
def submission_stats(request):
stats = OrderedDict()
todays_date = datetime.today()
all_projects = [PublishedProject.objects.filter(is_legacy=False), ActiveProject.objects.all(),
ArchivedProject.objects.all()]
all_projects = [PublishedProject.objects.filter(is_legacy=False), ActiveProject.objects.all()]
cur_year = todays_date.year
cur_month = todays_date.month

Expand Down
1 change: 1 addition & 0 deletions physionet-django/physionet/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ class StorageTypes:

# User model configurable settings
MAX_EMAILS_PER_USER = config('MAX_EMAILS_PER_USER', cast=int, default=10)
MAX_SUBMITTABLE_PROJECTS = config('MAX_SUBMITTABLE_PROJECTS', cast=int, default=10)

# Updating to Django to 3.2 requires DEFAULT_AUTO_FIELD to be specified
# Starting at 3.2, new projects are generated with DEFAULT_AUTO_FIELD set to BigAutoField
Expand Down
90 changes: 45 additions & 45 deletions physionet-django/project/fixtures/demo-project.json
Original file line number Diff line number Diff line change
Expand Up @@ -914,51 +914,6 @@
"description": "An implementation of a statistical or machine learning model with potential for reuse by the research community. Typically models will be created by a training process and may have dependencies on specific computational frameworks."
}
},
{
"model": "project.archivedproject",
"pk": 6,
"fields": {
"resource_type": 1,
"title": "Failed demo software for parsing clinical notes",
"abstract": "<p>Demo abstract</p>",
"background": "<p>Demo background</p>",
"methods": "<p>Demo methods</p>",
"content_description": "<p>Demo content description</p>",
"usage_notes": "<p>Demo usage notes</p>",
"installation": "<p>Demo installation</p>",
"acknowledgements": "<p>Demo acknowledgements</p>",
"conflicts_of_interest": "<p>Demo conflicts of interest</p>",
"version": "1.0",
"release_notes": "<p>Demo release notes</p>",
"short_description": "",
"access_policy": 0,
"license": null,
"dua": null,
"project_home_page": "",
"core_project": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
"editor": null,
"submission_datetime": "2020-04-07T15:54:54.860Z",
"author_comments": "",
"editor_assignment_datetime": "2020-04-13T16:06:22.892Z",
"revision_request_datetime": null,
"resubmission_datetime": null,
"editor_accept_datetime": "2020-04-20T16:06:55.526Z",
"copyedit_completion_datetime": "2020-04-21T16:07:36.681Z",
"author_approval_datetime": "2020-04-22T16:08:02Z",
"creation_datetime": "2020-04-10T15:54:54.860Z",
"modified_datetime": "2020-05-11T16:07:36.681Z",
"is_new_version": false,
"slug": "t2ASGLbIBoWaTJvPrM2A",
"latest_reminder": null,
"doi": null,
"archive_datetime": "2020-05-21T16:07:36.681Z",
"archive_reason": 3,
"parent_projects": [],
"programming_languages": [],
"allow_file_downloads": true,
"ethics_statement": "The authors declare no ethics concerns."
}
},
{
"model": "project.activeproject",
"pk": 1,
Expand Down Expand Up @@ -1233,6 +1188,51 @@
"required_trainings": [1]
}
},
{
"model": "project.activeproject",
"pk": 9,
"fields": {
"resource_type": 1,
"title": "Failed demo software for parsing clinical notes",
"abstract": "<p>Demo abstract</p>",
"background": "<p>Demo background</p>",
"methods": "<p>Demo methods</p>",
"content_description": "<p>Demo content description</p>",
"usage_notes": "<p>Demo usage notes</p>",
"installation": "<p>Demo installation</p>",
"acknowledgements": "<p>Demo acknowledgements</p>",
"conflicts_of_interest": "<p>Demo conflicts of interest</p>",
"version": "2.0",
"release_notes": "<p>This is version 2.0</p>",
"short_description": "Demo short description",
"access_policy": 0,
"license": 9,
"dua": null,
"project_home_page": "",
"core_project": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
"editor": null,
"submission_datetime": "2020-04-10T16:08:53.263Z",
"author_comments": "",
"editor_assignment_datetime": "2020-04-10T16:09:06.581Z",
"revision_request_datetime": null,
"resubmission_datetime": null,
"editor_accept_datetime": null,
"copyedit_completion_datetime": null,
"author_approval_datetime": null,
"creation_datetime": "2020-04-10T16:08:49.323Z",
"modified_datetime": "2020-04-10T16:08:49.323Z",
"is_new_version": false,
"slug": "t2ASGLbIBoWaTJvPrM2A",
"latest_reminder": null,
"doi": null,
"submission_status": 5,
"parent_projects": [],
"programming_languages": [],
"allow_file_downloads": true,
"ethics_statement": "The authors declare no ethics concerns.",
"required_trainings": [1]
}
},
{
"model": "project.publishedproject",
"pk": 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from django.db import migrations, models
from project.models import PublishedProject, ActiveProject, ArchivedProject, LegacyProject


def migrate_forward(apps, schema_editor):
PublishedProject = apps.get_model("project", "PublishedProject")
ActiveProject = apps.get_model("project", "ActiveProject")
ArchivedProject = apps.get_model("project", "ArchivedProject")

for project in PublishedProject.objects.all():
refs = project.references.all().order_by('id')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.1.10 on 2023-12-01 07:00

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("project", "0072_aws"),
]

operations = [
migrations.AddField(
model_name="activeproject",
name="archive_datetime",
field=models.DateTimeField(blank=True, null=True),
),
]
Loading
Loading