Skip to content

Commit

Permalink
Merge branch 'dev' into au/event/feature/show_inactive_participants
Browse files Browse the repository at this point in the history
  • Loading branch information
Rutvikrj26 authored Nov 1, 2023
2 parents 0e6ca6a + 2f80538 commit 9467e40
Show file tree
Hide file tree
Showing 74 changed files with 1,966 additions and 797 deletions.
4 changes: 1 addition & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ GCS_SIGNED_URL_LIFETIME_IN_MINUTES=1440
# GCP Research Environments
ENABLE_CLOUD_RESEARCH_ENVIRONMENTS="False"
CLOUD_RESEARCH_ENVIRONMENTS_API_URL="https://example.api"
CLOUD_RESEARCH_ENVIRONMENTS_API_JWT_SERVICE_ACCOUNT_PATH="environment/api/tests/service_account.json"
CLOUD_RESEARCH_ENVIRONMENTS_API_JWT_AUDIENCE="https://example.com"

# Site-specific content
SITE_NAME="DataShare"
Expand Down Expand Up @@ -187,7 +185,7 @@ MIN_WORDS_RESEARCH_SUMMARY_CREDENTIALING = 20
# CITISOAPService API
# This is the WebServices username and password to access the CITI SOAP Service to obtain users training report details
# The account can be created at https://webservices.citiprogram.org/login/CreateAccount.aspx
# The SOAP Service Access can be tested at https://webservices.citiprogram.org/Client/CITISOAPClient_Simple.aspx
# The SOAP Service Access can be tested at https://webservices.citiprogram.org/Client/CITISOAPClient_Simple.aspx
CITI_USERNAME=
CITI_PASSWORD=
CITI_SOAP_URL="https://webservices.citiprogram.org/SOAP/CITISOAPService.asmx"
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/physionet-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
test:
name: Test
runs-on: ubuntu-latest
container: debian:11
container: ${{ matrix.container }}
env:
DJANGO_SETTINGS_MODULE: physionet.settings.settings
TEST_GCS_INTEGRATION: false
Expand All @@ -26,6 +26,7 @@ jobs:
fail-fast: false
matrix:
pip3: ['poetry', 'requirements.txt']
container: ['debian:11', 'debian:12']
steps:

- name: Update packages
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/physionet-upgrade-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ jobs:
testupgrade:
name: Upgrade Test
runs-on: ubuntu-latest
container: debian:11
container: ${{ matrix.container }}
strategy:
matrix:
container: ['debian:11', 'debian:12']
steps:
- name: Install dependencies
run: |
Expand Down
6 changes: 3 additions & 3 deletions deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ cd /physionet
# Copy over the .env file into /physionet/physionet-build
scp <somewhere>/.env /physionet/physionet-build/
# The software folder should be owned by the dedicated user. The socket file directory should be accessible by nginx.
chown -R pn.pn /physionet
chown pn.www-data /physionet/deploy
chown -R pn:pn /physionet
chown pn:www-data /physionet/deploy
chmod g+w /physionet/deploy
# Make the static and media roots
mkdir /data
mkdir /data/pn-static
mkdir /data/pn-static/published-projects
mkdir /data/pn-media
mkdir /data/pn-media/{active-projects,archived-projects,credential-applications,published-projects,users}
chown -R pn.pn /data/{pn-media,pn-static}
chown -R pn:pn /data/{pn-media,pn-static}
```

The directory structure for the site's software and files will be:
Expand Down
12 changes: 6 additions & 6 deletions deploy/test-server/install-pn-test-server
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ printf '%s\n%s\n' "$DBPASSWORD" "$DBPASSWORD" |
su postgres -c 'createdb physionet -O physionet'

mkdir -p /physionet /data/pn-static /data/pn-media
chown pn.pn /physionet /data/pn-static /data/pn-media
chown pn:pn /physionet /data/pn-static /data/pn-media
su pn -c '
set -e
umask 0002
Expand Down Expand Up @@ -153,17 +153,17 @@ su pn -c '
yes | python3 manage.py loaddemo
'

chown www-data.www-data -R /physionet/deploy
chown www-data.www-data -R /data/pn-media
chown www-data.www-data -R /data/pn-static/published-projects
chown www-data:www-data -R /physionet/deploy
chown www-data:www-data -R /data/pn-media
chown www-data:www-data -R /data/pn-static/published-projects

rm /etc/nginx/sites-enabled/default
ln -s ../sites-available/physionet_nginx.conf \
/etc/nginx/sites-enabled/physionet_nginx.conf

mkdir /data/log /data/log/nginx /data/log/uwsgi /data/log/pn
chown www-data.root /data/log/uwsgi
chown pn.root /data/log/pn
chown www-data:root /data/log/uwsgi
chown pn:root /data/log/pn

(
cd /physionet/physionet-build/deploy/common
Expand Down
52 changes: 38 additions & 14 deletions physionet-django/console/forms.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import pdb
import re

from django.forms.widgets import RadioSelect

from django.forms.widgets import RadioSelect

from console.utility import generate_doi_payload, register_doi
from dal import autocomplete
from django import forms
Expand All @@ -27,9 +22,10 @@
PublishedAffiliation,
PublishedAuthor,
PublishedProject,
PublishedPublication,
SubmissionStatus,
exists_project_slug,
)
from project.projectfiles import ProjectFiles
from project.validators import MAX_PROJECT_SLUG_LENGTH, validate_doi, validate_slug
from user.models import CodeOfConduct, CredentialApplication, CredentialReview, User, TrainingQuestion

Expand Down Expand Up @@ -91,10 +87,12 @@ def __init__(self, *args, **kwargs):
.order_by('username')

def clean_project(self):
pid = self.cleaned_data['project']
pid = self.cleaned_data["project"]
validate_integer(pid)
if ActiveProject.objects.get(id=pid) not in ActiveProject.objects.filter(submission_status=10):
raise forms.ValidationError('Incorrect project selected.')
if ActiveProject.objects.get(id=pid) not in ActiveProject.objects.filter(
submission_status=SubmissionStatus.NEEDS_ASSIGNMENT
):
raise forms.ValidationError("Incorrect project selected.")
return pid


Expand Down Expand Up @@ -230,13 +228,13 @@ def save(self):
edit_log = EditLog.objects.get(id=edit_log.id)
# Resubmit with revisions
elif edit_log.decision == 1:
project.submission_status = 30
project.submission_status = SubmissionStatus.NEEDS_RESUBMISSION
project.revision_request_datetime = now
project.latest_reminder = now
project.save()
# Accept
else:
project.submission_status = 40
project.submission_status = SubmissionStatus.NEEDS_COPYEDIT
project.editor_accept_datetime = now
project.latest_reminder = now

Expand Down Expand Up @@ -289,7 +287,7 @@ def save(self):
project = copyedit_log.project
now = timezone.now()
copyedit_log.complete_datetime = now
project.submission_status = 50
project.submission_status = SubmissionStatus.NEEDS_APPROVAL
project.copyedit_completion_datetime = now
project.latest_reminder = now
copyedit_log.save()
Expand All @@ -310,12 +308,12 @@ def __init__(self, project, *args, **kwargs):
super().__init__(*args, **kwargs)
self.project = project
# No option to set slug if publishing new version
if self.project.version_order:
if self.project.is_new_version:
del(self.fields['slug'])
else:
self.fields['slug'].initial = project.slug

if not ProjectFiles().can_make_zip():
if not project.files.can_make_zip():
self.fields['make_zip'].disabled = True
self.fields['make_zip'].required = False
self.fields['make_zip'].initial = 0
Expand Down Expand Up @@ -705,6 +703,32 @@ def save(self):
return contact


class AddPublishedPublicationForm(forms.ModelForm):
class Meta:
model = PublishedPublication
fields = ('citation', 'url')

def __init__(self, project, *args, **kwargs):
super().__init__(*args, **kwargs)
self.project = project

def clean(self):
cleaned_data = super().clean()
existing_publication = PublishedPublication.objects.filter(project=self.project).first()

if existing_publication:
raise forms.ValidationError("A publication already exists for this project.")

return cleaned_data

def save(self, commit=True):
publication = super().save(commit=False)
publication.project = self.project
if commit:
publication.save()
return publication


class CreateLegacyAuthorForm(forms.ModelForm):
"""
Create an author for a legacy project.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,16 @@
<span class="nav-link-text">Events</span>
</a>
<!-- submenu -->
{% if events_nav %}
{% if nav_event_active or nav_event_archive %}
<ul class="sidenav-second-level collapse show" id="events">
{% else %}
<ul class="sidenav-second-level collapse" id="events">
{% endif %}
<li class="nav-item {% if events_nav %}active{% endif %}">
<a id="nav_events" class="nav-link" href="{% url 'event' %}">Event List</a>
<li class="nav-item {% if nav_event_active %}active{% endif %}">
<a id="nav_event_active" class="nav-link" href="{% url 'event_active' %}">Active</a>
</li>
<li class="nav-item {% if nav_event_archive %}active{% endif %}">
<a id="nav_event_archive" class="nav-link" href="{% url 'event_archive' %}">Archived</a>
</li>
</ul>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ <h3>Discovery</h3>
</script>

<script>disableAddButtons();</script>
{% if project.has_other_versions or project.version_order %}
{% if project.is_new_version %}
<script src="{% static 'custom/js/disable-title.js' %}"></script>
{% endif %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{% block content %}
<div class="card mb-3">
<div class="card-header">
Events <span class="badge badge-pill badge-info">{{ events.paginator.count }}</span>
Active Events <span class="badge badge-pill badge-info">{{ event_active.paginator.count }}</span>
</div>
<div class="card-body">
<div class="table-responsive">
Expand All @@ -32,7 +32,7 @@
</tr>
</thead>
<tbody>
{% for event in events %}
{% for event in event_active %}
<tr>
<td><a href="{% url 'event_detail' event.slug %}">{{ event.title }}</a></td>
<td>{{ event.get_category_display|title }}</td>
Expand Down
55 changes: 55 additions & 0 deletions physionet-django/console/templates/console/event_archive.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{% extends "console/base_console.html" %}

{% load static %}

{% block title %}Archived Events{% endblock %}

{% block local_css %}
<link rel="stylesheet" type="text/css" href="{% static 'custom/css/pagination.css' %}">
{% endblock %}

{% load console_templatetags %}

{% block content %}
<div class="card mb-3">
<div class="card-header">
Archived Events <span class="badge badge-pill badge-info">{{ event_archive.paginator.count }}</span>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>Event</th>
<th>Event Type</th>
<th>Host</th>
<th>Created</th>
<th>Started</th>
<th>Ended</th>
<th>Credentialing</th>
<th>Training</th>
<th>Manage</th>
</tr>
</thead>
<tbody>
{% for event in event_archive %}
<tr>
<td><a href="{% url 'event_detail' event.slug %}">{{ event.title }}</a></td>
<td>{{ event.get_category_display|title }}</td>
<td>{{ event.host }}</td>
<td>{{ event.added_datetime|date }}</td>
<td>{{ event.start_date }}</td>
<td>{{ event.end_date }}</td>
<td><a href = "{% url 'credential_processing' %}?event={{ event.slug }}">View list</a></td>
<td><a href = "{% url 'training_list' status='review' %}?event={{ event.slug }}">View list</a></td>
<td><a href="{% url 'event_management' event.slug %}" class="btn btn-sm btn-primary" role="button">Manage</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% include "console/pagination.html" with pagination=events %}
</div>
</div>
</div>
{% endblock %}

Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ <h4 class="card-title"><a href="{% url 'published_project' project.slug project.
</div>
</div>
</div>

<!-- legacy project management -->
{% if project.is_legacy %}
<div class="card mb-3">
Expand All @@ -67,6 +68,28 @@ <h3>Add an author</h3>
</div>
{% endif %}

<!-- Associated publication -->
<div class="card mb-3">
<div class="card-header">
Associated publication
</div>
<div class="card-body">
{% if project.publications.all %}
{% for publication in project.publications.all %}
<p><strong>Citation</strong>: {{ publication.citation }}<br />
<strong>URL</strong>: {{ publication.url }}</p>
{% endfor %}
{% else %}
<form method="POST" id="publication_form">
{% include "inline_form_snippet.html" with form=publication_form %}
<button class="btn btn-primary btn-fixed" name="set_publication" type="submit">Add publication</button>
</form>
{% endif %}

</div>
</div>


<div class="card mb-3">
<div class="card-header">
Contact information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<a class="nav-link {% if passphrase %} active {% endif %}" id="embargo-tab" data-toggle="tab" href="#embargo" role="tab" aria-controls="reassign" aria-selected="false">Embargo</a>
</li>
{% endif %}
{% if project.submission_status >= 40 %}
{% if project.submission_status >= SubmissionStatus.NEEDS_COPYEDIT %}
<li class="nav-item">
<a class="nav-link" id="doi-tab" data-toggle="tab" href="#doi" role="tab" aria-controls="timeline" aria-selected="false">DOIs</a>
</li>
Expand All @@ -40,7 +40,7 @@ <h4 class="card-title">{{ project.title }}</h4>
Created: {{ project.creation_datetime|date }}. Submitted: {{ project.submission_datetime|date }}.<br>
Storage Used: {{ storage_info.readable_used }} / {{ storage_info.readable_allowance }}<br>
Version: {{ project.version }}
{% if project.version_order %}<br>Latest Published Version: <a href="{% url 'published_project' latest_version.slug latest_version.version %}" target="_blank">{{ latest_version.version }}</a>{% endif %}
{% if project.is_new_version %}<br>Latest Published Version: <a href="{% url 'published_project' latest_version.slug latest_version.version %}" target="_blank">{{ latest_version.version }}</a>{% endif %}
{% if project.latest_reminder %}
<br>Latest reminder email sent on: {{ project.latest_reminder }}
{% endif %}
Expand Down
Loading

0 comments on commit 9467e40

Please sign in to comment.