Skip to content
Open
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: 2 additions & 2 deletions makeabilitylab/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ def parse_allowed_hosts(value, django_env):
CSRF_COOKIE_SECURE = True

# Makeability Lab Global Variables, including Makeability Lab version
ML_WEBSITE_VERSION = "2.35.5" # Keep this updated with each release and also change the short description below
ML_WEBSITE_VERSION_DESCRIPTION = "Each of the three login-throttle pages under Administration (Access attempts, logs, failures) now explains what it records and how to unlock an account."
ML_WEBSITE_VERSION = "2.35.7" # Keep this updated with each release and also change the short description below
ML_WEBSITE_VERSION_DESCRIPTION = "Projects with no new paper, talk, poster, video, or news for a year now show as Past (unless marked Keep active), and Completed Projects is renamed Past Projects."
DATE_MAKEABILITYLAB_FORMED = datetime.date(2012, 1, 1) # Date Makeability Lab was formed
MAX_BANNERS = 7 # Maximum number of banners on a page

Expand Down
1 change: 1 addition & 0 deletions website/admin/data_health/checks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
unlinked_artifacts,
project_health,
project_leadership,
project_activity,
position_integrity,
news_health,
duplicate_keywords,
Expand Down
68 changes: 68 additions & 0 deletions website/admin/data_health/checks/project_activity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
"""
Data-health check: projects shown as Past only because they went quiet (#1473).

The public site derives a project's Active/Past status (see
``Project.is_past()``): with no ``end_date``, a project goes Past after
``INACTIVE_AFTER_DAYS`` (365) days with no new publication, talk, poster, video,
or tagged news item (``start_date`` counts too, as a grace period). That guess
is never written to the database, so this check lists the projects it applies
to, for an editor to confirm:

- **inactive** — Past by inactivity. Set a real end date if it's done, or check
"Keep active" if it's a long-running project that's still alive.
- **no activity signal** — no start date and nothing linked, so the site can't
judge and keeps it Active. Add a start date (and artifacts).

Only visible projects are listed; ``keep_active`` projects and projects with an
``end_date`` are skipped (an editor already decided). Read-only.
"""

from django.utils import timezone

from website.admin.data_health.registry import HealthCheck, register_check
from website.models import Project


@register_check
class ProjectActivityCheck(HealthCheck):
slug = 'project-activity'
title = 'Projects past by inactivity'
description = (
'Visible projects with no end date that the site shows as Past because '
'nothing new has been linked to them in a year, or that have no start '
'date or activity at all. Set an end date, or check "Keep active".'
)
group = 'Projects'
link_model = 'project'
columns = [
'id', 'name', 'short_name', 'start_date', 'last_activity_date',
'days_inactive', 'issues',
]

def get_rows(self):
today = timezone.localdate()
rows = []
projects = (Project.objects
.filter(is_visible=True, end_date__isnull=True, keep_active=False)
.with_activity())
for project in projects:
last = project.last_activity_date
if last is None:
issue = 'no activity signal'
elif project.is_past():
issue = 'inactive'
else:
continue
rows.append({
'id': project.pk,
'name': project.name,
'short_name': project.short_name,
'start_date': project.start_date,
'last_activity_date': last,
'days_inactive': (today - last).days if last else None,
'issues': issue,
})

# Longest-dormant first; projects with no signal at the end.
rows.sort(key=lambda r: (r['days_inactive'] is None, -(r['days_inactive'] or 0)))
return rows
15 changes: 8 additions & 7 deletions website/admin/data_health/checks/project_leadership.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
- **no PI** — the project has no ``ProjectRole`` marked PI at all. Per the model
help text, most projects should have Jon Froehlich as PI, so a project with
zero PI roles is almost always an oversight.
- **no active PI** — the project hasn't ended, but every PI role on it has an
end date in the past, so nobody is currently the PI of a live project.
- **no active PI** — the project is still Active (``Project.is_past()``,
#1473), but every PI role on it has an end date in the past, so nobody is
currently the PI of a live project.

Co-PI absence is intentionally *not* flagged: many projects legitimately have
only a PI. The Co-PI count is surfaced as context. Read-only.
Expand All @@ -32,14 +33,14 @@ class ProjectLeadershipCheck(HealthCheck):
group = 'Projects'
link_model = 'project'
columns = [
'id', 'name', 'short_name', 'is_visible', 'has_ended',
'id', 'name', 'short_name', 'is_visible', 'is_past',
'pi_count', 'active_pi_count', 'copi_count', 'pis', 'issues',
]

def get_rows(self):
today = date.today()
rows = []
projects = Project.objects.all().prefetch_related('projectrole_set__person')
projects = Project.objects.with_activity().prefetch_related('projectrole_set__person')
for project in projects:
roles = list(project.projectrole_set.all())
pi_roles = [
Expand All @@ -58,12 +59,12 @@ def _is_active(role):
)

active_pi_count = sum(1 for r in pi_roles if _is_active(r))
has_ended = project.has_ended()
is_past = project.is_past()

issues = []
if not pi_roles:
issues.append('no PI')
elif not has_ended and active_pi_count == 0:
elif not is_past and active_pi_count == 0:
issues.append('no active PI')

if not issues:
Expand All @@ -77,7 +78,7 @@ def _is_active(role):
'name': project.name,
'short_name': project.short_name,
'is_visible': bool(project.is_visible),
'has_ended': has_ended,
'is_past': is_past,
'pi_count': len(pi_roles),
'active_pi_count': active_pi_count,
'copi_count': len(copi_roles),
Expand Down
Loading
Loading