-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature/revise study end questions 4 #707
Changes from 11 commits
2f46c2f
045e437
b3ed947
40e7235
fb6b7d8
1b538c3
6446f56
1515411
8c523b5
33be1ae
712270f
d75c387
d00f26c
72634a5
4d094e1
a2a2fa9
e3f9788
17a6d1d
6c0c319
44ecaca
b3f7861
a29de10
703ddfe
41e6347
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Generated by Django 4.2.11 on 2024-09-24 14:18 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("proposals", "0053_auto_20240201_1557"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="proposal", | ||
name="knowledge_security", | ||
field=models.CharField( | ||
blank=True, | ||
choices=[("Y", "ja"), ("N", "nee"), ("?", "twijfel")], | ||
help_text="Kennisveiligheid gaat over het tijdig signaleren en mitigeren van veiligheidsrisico's bij wetenschappelijk onderzoek. Klik <a href='https://intranet.uu.nl/kennisbank/kennisveiligheid'>hier</a> voor meer informatie.", | ||
max_length=1, | ||
verbose_name="Zijn er kwesties rondom kennisveiligheid?", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="proposal", | ||
name="knowledge_security_details", | ||
field=models.TextField( | ||
blank=True, max_length=200, verbose_name="Licht toe" | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="proposal", | ||
name="researcher_risk", | ||
field=models.CharField( | ||
blank=True, | ||
choices=[("Y", "ja"), ("N", "nee"), ("?", "twijfel")], | ||
help_text="Houd hierbij niet alleen rekening met mogelijke psychische of fysieke schade, maar ook met andere mogelijke schade, zoals bijv. hiërarchische machtsverhoudingen in veldwerk, mogelijke negatieve gevolgen voor de zichtbaarheid/vindbaarheid van de onderzoeker in in het publieke domein, juridische vervolging of aansprakelijkheid, e.d.", | ||
max_length=1, | ||
verbose_name="Zijn er kwesties rondom de veiligheid van of risico's voor de onderzoeker(s)?", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="proposal", | ||
name="researcher_risk_details", | ||
field=models.TextField( | ||
blank=True, max_length=200, verbose_name="Licht toe" | ||
), | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -497,6 +497,42 @@ class PracticeReasons(models.IntegerChoices): | |
MaxWordsValidator(SELF_ASSESSMENT_MAX_WORDS), | ||
], | ||
) | ||
knowledge_security = models.CharField( | ||
_("Zijn er kwesties rondom kennisveiligheid?"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Many of these strings remain untranslated |
||
help_text=mark_safe_lazy( | ||
_( | ||
"Kennisveiligheid gaat over het tijdig signaleren en mitigeren " | ||
"van veiligheidsrisico's bij wetenschappelijk onderzoek. Klik " | ||
"<a href='https://intranet.uu.nl/kennisbank/kennisveiligheid'>hier</a> " | ||
"voor meer informatie." | ||
) | ||
), | ||
max_length=1, | ||
choices=YesNoDoubt.choices, | ||
blank=True, | ||
) | ||
knowledge_security_details = models.TextField( | ||
_("Licht toe"), max_length=200, blank=True | ||
) | ||
researcher_risk = models.CharField( | ||
_( | ||
"Zijn er kwesties rondom de veiligheid van of risico's voor de onderzoeker(s)?" | ||
), | ||
help_text=_( | ||
"Houd hierbij niet alleen rekening met mogelijke psychische of " | ||
"fysieke schade, maar ook met andere mogelijke schade, zoals bijv. " | ||
"hiërarchische machtsverhoudingen in veldwerk, mogelijke negatieve " | ||
"gevolgen voor de zichtbaarheid/vindbaarheid van de onderzoeker in " | ||
"in het publieke domein, juridische vervolging of " | ||
"aansprakelijkheid, e.d." | ||
), | ||
max_length=1, | ||
choices=YesNoDoubt.choices, | ||
blank=True, | ||
) | ||
researcher_risk_details = models.TextField( | ||
_("Licht toe"), max_length=200, blank=True | ||
) | ||
|
||
# References to other models | ||
relation = models.ForeignKey( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{% extends "base/fetc_form_base.html" %} | ||
|
||
{% load static %} | ||
{% load i18n %} | ||
|
||
{% block header_title %} | ||
{% trans "Afronding trajecten" %} - {{ block.super }} | ||
{% endblock %} | ||
|
||
{% block html_head %} | ||
{{ block.super }} | ||
<script> | ||
$(function () { | ||
depends_on_list_value('knowledge_security', ['Y', '?'], 'knowledge_security_details'); | ||
depends_on_list_value('researcher_risk', ['Y', '?'], 'researcher_risk_details'); | ||
}); | ||
</script> | ||
{% endblock %} | ||
|
||
{% block pre-form-text %} | ||
<h3>{% trans "Afronding trajecten" %}</h3> | ||
{% endblock %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -323,6 +323,7 @@ def remaining_checkers( | |
self, | ||
): | ||
return [ | ||
KnowledgeSecurityChecker(self.stepper, parent=self.item), | ||
DocumentsChecker, | ||
DataManagementChecker, | ||
SubmitChecker, | ||
|
@@ -350,6 +351,24 @@ def get_form_kwargs(self): | |
return kwargs | ||
|
||
|
||
class KnowledgeSecurityChecker( | ||
ModelFormChecker, | ||
): | ||
form_class = proposal_forms.KnowledgeSecurityForm | ||
title = _("Traject afronding") | ||
|
||
def check(self): | ||
if self.stepper.has_multiple_studies(): | ||
self.title = _("Trajecten afronding") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice touch |
||
self.stepper.items.append(self.make_stepper_item()) | ||
return [] | ||
|
||
def get_url( | ||
self, | ||
): | ||
return reverse("proposals:knowledge_security", args=[self.proposal.pk]) | ||
|
||
|
||
class StudyChecker( | ||
Checker, | ||
): | ||
|
@@ -497,7 +516,7 @@ def get_url( | |
class StudyEndChecker( | ||
ModelFormChecker, | ||
): | ||
title = _("Afronding") | ||
title = _("Traject overzicht") | ||
form_class = study_forms.StudyEndForm | ||
|
||
def __init__( | ||
|
@@ -803,7 +822,7 @@ def make_stepper_item(self): | |
class TranslationChecker( | ||
ModelFormChecker, | ||
): | ||
form_class = proposal_forms.TranslatedConsentForms | ||
form_class = proposal_forms.TranslatedConsentForm | ||
title = _("Vertalingen") | ||
location = "data_management" | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -827,8 +827,6 @@ class StudyOverviewSection(BaseSection): | |
"deception_details", | ||
"negativity", | ||
"negativity_details", | ||
"stressful", | ||
"stressful_details", | ||
"risk", | ||
"risk_details", | ||
] | ||
|
@@ -842,7 +840,7 @@ def get_row_fields(self): | |
obj = self.obj | ||
|
||
rows_to_remove = [] | ||
for x in range(0, 7, 2): | ||
for x in range(0, len(self.row_fields), 2): | ||
if getattr(obj, rows[x]) == "N": | ||
rows_to_remove.append(rows[x + 1]) | ||
rows = [row for row in rows if row not in rows_to_remove] | ||
|
@@ -856,6 +854,30 @@ def get_row_fields(self): | |
return rows | ||
|
||
|
||
class KnowledgeSecuritySection(BaseSection): | ||
"""This class receives a Proposal object.""" | ||
|
||
section_title = _("Kennisveiligheid en risico onderzoekers") | ||
row_fields = [ | ||
"knowledge_security", | ||
"knowledge_security_details", | ||
"researcher_risk", | ||
"researcher_risk_details", | ||
] | ||
|
||
def get_row_fields(self): | ||
rows = copy(self.row_fields) | ||
obj = self.obj | ||
|
||
rows_to_remove = [] | ||
for x in range(0, len(self.row_fields), 2): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is such an unnecessarily complicated way to remove at most two fields. But it's kind of funny as well There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I have kindoff a love/hate relationship with this ... I often start thinking of a way to get rid of it, but then end up spending too much time on it (again ...) and I just move on. I'll get around to it someday ;p |
||
if getattr(obj, rows[x]) == "N": | ||
rows_to_remove.append(rows[x + 1]) | ||
rows = [row for row in rows if row not in rows_to_remove] | ||
|
||
return rows | ||
|
||
|
||
class InformedConsentFormsSection(BaseSection): | ||
"""This class receives a Documents object""" | ||
|
||
|
@@ -997,24 +1019,24 @@ def get_extra_documents(obj): | |
return extra_documents | ||
|
||
|
||
def create_context_pdf(context, model): | ||
def create_context_pdf(context, proposal): | ||
"""A function to create the context for the PDF, which gets called in the ProposalAsPdf view.""" | ||
|
||
sections = [] | ||
|
||
sections.append(GeneralSection(model)) | ||
sections.append(GeneralSection(proposal)) | ||
|
||
if hasattr(model, "wmo"): | ||
sections.append(WMOSection(model.wmo)) | ||
if hasattr(proposal, "wmo"): | ||
sections.append(WMOSection(proposal.wmo)) | ||
|
||
if not model.is_pre_assessment: | ||
if model.wmo.status != model.wmo.WMOStatuses.NO_WMO: | ||
sections.append(METCSection(model.wmo)) | ||
if not proposal.is_pre_assessment: | ||
if proposal.wmo.status != proposal.wmo.WMOStatuses.NO_WMO: | ||
sections.append(METCSection(proposal.wmo)) | ||
|
||
sections.append(TrajectoriesSection(model)) | ||
sections.append(TrajectoriesSection(proposal)) | ||
|
||
if model.wmo.status == model.wmo.WMOStatuses.NO_WMO: | ||
for study in model.study_set.all(): | ||
if proposal.wmo.status == proposal.wmo.WMOStatuses.NO_WMO: | ||
for study in proposal.study_set.all(): | ||
sections.append(StudySection(study)) | ||
if study.has_intervention: | ||
sections.append(InterventionSection(study.intervention)) | ||
|
@@ -1029,15 +1051,17 @@ def create_context_pdf(context, model): | |
sections.append(StudyOverviewSection(study)) | ||
sections.append(InformedConsentFormsSection(study.documents)) | ||
|
||
extra_documents = get_extra_documents(model) | ||
sections.append(KnowledgeSecuritySection(proposal)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When generating a PDF for a proposal with sessions, line 1050 causes an error. I suspect this is just a mismatched indent and that the line just needs one more indentation level. This doesn't seem to be related to this PR in particular, so I couldn't select the specific line in this review. But if you could quickly fix it here that would be great. |
||
|
||
extra_documents = get_extra_documents(proposal) | ||
|
||
for num, document in enumerate(extra_documents): | ||
sections.append(ExtraDocumentsSection(document, num)) | ||
|
||
sections.append(DMPFileSection(model)) | ||
sections.append(DMPFileSection(proposal)) | ||
|
||
sections.append(EmbargoSection(model)) | ||
sections.append(CommentsSection(model)) | ||
sections.append(EmbargoSection(proposal)) | ||
sections.append(CommentsSection(proposal)) | ||
|
||
context["sections"] = sections | ||
|
||
|
@@ -1193,6 +1217,13 @@ def create_context_diff(context, old_proposal, new_proposal): | |
) | ||
) | ||
|
||
sections.append( | ||
DiffSection( | ||
KnowledgeSecuritySection(old_proposal), | ||
KnowledgeSecuritySection(new_proposal), | ||
) | ||
) | ||
|
||
old_extra_docs = get_extra_documents(old_proposal) | ||
new_extra_docs = get_extra_documents(new_proposal) | ||
|
||
|
@@ -1210,7 +1241,7 @@ def create_context_diff(context, old_proposal, new_proposal): | |
|
||
sections.append( | ||
DiffSection( | ||
*multi_sections(DMPFileSection, [old_proposal, new_proposal]) | ||
DMPFileSection(old_proposal), DMPFileSection(new_proposal) | ||
) | ||
) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
TranslatedConsentFormsView
still uses a plural which is a tiny bit confusing