Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Evaluation student #422

Draft
wants to merge 41 commits into
base: staging
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
a5dedaa
Added evaluation app
n-hackert Apr 12, 2020
d2547df
Added url mapping to evaluation app
n-hackert Apr 12, 2020
ac4244e
Added Dummy-Model and View
n-hackert Apr 12, 2020
4033577
Added basic(est) permission check to student-evaluation form and eval…
n-hackert Apr 13, 2020
8ac3414
migrations
n-hackert Apr 13, 2020
db52494
Revert changes to scripts and docker-compose
n-hackert Apr 13, 2020
04ef4d4
Merge remote-tracking branch 'upstream/staging' into evaluation_student
n-hackert Apr 13, 2020
71c7f2c
Merge branch 'staging' into evaluation_student
Baschdl Apr 14, 2020
bdf30a2
Merge remote-tracking branch 'upstream/staging' into evaluation_student
n-hackert Apr 17, 2020
8aca609
Removed permission checks for evaluation
n-hackert Apr 17, 2020
f776b39
Removed obsolete migration
n-hackert Apr 17, 2020
ce60729
Added evaluation models for institutions and students
n-hackert Apr 18, 2020
b63318b
shortened URL
n-hackert Apr 18, 2020
6fb782c
Added StudentEvaluationForm
n-hackert Apr 23, 2020
26eafab
Added Completed URL; added Name to URL-Mappings
n-hackert Apr 26, 2020
5e84c47
Small model related fixes
n-hackert Apr 26, 2020
d43cc65
Fixed Form and added Template
n-hackert Apr 26, 2020
cf503e8
Added form to views.py
n-hackert Apr 26, 2020
8699fdf
Added basic "Completed" Template
n-hackert Apr 26, 2020
a261e94
Merge remote-tracking branch 'upstream/staging' into evaluation_student
n-hackert Apr 26, 2020
bfea9be
Improved form layout and redirect
n-hackert Apr 28, 2020
6705100
Improved form layout and redirect
n-hackert Apr 28, 2020
68c8555
Improved Form layout Vol 2
n-hackert Apr 28, 2020
ddd8227
Improved eval model
n-hackert Apr 28, 2020
f9d7ca5
Implemented skeleton for institution eval
n-hackert Apr 28, 2020
2d53737
Migrations
n-hackert Apr 28, 2020
56fe700
Merge branch 'staging' into evaluation_student
Baschdl May 1, 2020
7bf120c
Merge branch 'staging' into evaluation_student
Baschdl May 1, 2020
7b92bf4
Merge branch 'staging' into evaluation_student
Baschdl May 1, 2020
596ebfc
Merge branch 'staging' into evaluation_student
Baschdl May 2, 2020
02d786d
Delete migration because already on staging
Baschdl May 2, 2020
b45f805
Merge branch 'staging' into evaluation_student
Baschdl May 3, 2020
ac77117
Merge remote-tracking branch 'upstream/staging' into evaluation_student
n-hackert May 18, 2020
9fd3f78
Completed form and model for institution eval
n-hackert May 19, 2020
bb1dcb6
Migrations
n-hackert May 19, 2020
444d7b0
Small fixes
n-hackert May 19, 2020
47a2b0b
Added referer check to thank you page
n-hackert May 19, 2020
8c1a133
Added translations
n-hackert May 19, 2020
0b1f532
Merge branch 'staging' into evaluation_student
Baschdl Jul 1, 2020
021fcbb
Fix translations
Baschdl Jul 1, 2020
6530c2c
Format code with pre-commit
Baschdl Jul 1, 2020
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
1 change: 1 addition & 0 deletions backend/apps/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@


class User(AbstractUser):

is_student = models.BooleanField(default=False)
is_hospital = models.BooleanField(default=False)
validated_email = models.BooleanField(default=False)
Expand Down
Empty file.
6 changes: 6 additions & 0 deletions backend/apps/evaluation/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.contrib import admin

from .models import InstitutionEvaluation, StudentEvaluation

admin.site.register(StudentEvaluation)
admin.site.register(InstitutionEvaluation)
5 changes: 5 additions & 0 deletions backend/apps/evaluation/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class EvaluationConfig(AppConfig):
name = "evaluation"
48 changes: 48 additions & 0 deletions backend/apps/evaluation/custom_crispy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from crispy_forms.bootstrap import Field
from crispy_forms.utils import TEMPLATE_PACK


class InputButtonGroup(Field):
"""
Layout object for rendering radio and checkbox elements as button groups::.

RadioButtons('field_name', [option_label_class="btn blue text-white btn-lg"])
"""

template = "%s/layout/input_buttongroup.html"

def __init__(self, *args, **kwargs):

try:
self.input_type
except AttributeError:
raise NotImplementedError(
"Cannot instantiate {}. input_type property must be set".format(
type(self).__name__
)
)

self.option_label_class = "btn btn-secondary"
if "option_label_class" in kwargs:
self.option_label_class = kwargs.pop("option_label_class")
super(InputButtonGroup, self).__init__(*args, **kwargs)

def render(self, form, form_style, context, template_pack=TEMPLATE_PACK, **kwargs):
return super(InputButtonGroup, self).render(
form,
form_style,
context,
template_pack=template_pack,
extra_context={
"input_type": self.input_type,
"option_label_class": self.option_label_class,
},
)


class RadioButtons(InputButtonGroup):
input_type = "radio"


class CheckboxButtons(InputButtonGroup):
input_type = "checkbox"
137 changes: 137 additions & 0 deletions backend/apps/evaluation/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout
from django import forms
from django.utils.translation import gettext_lazy as _

from apps.evaluation.custom_crispy import RadioButtons
from apps.evaluation.models import InstitutionEvaluation, StudentEvaluation


def make_button_group(field):
return RadioButtons(
field,
option_label_class="btn btn-md blue text-white",
template="evaluation/input_buttongroup-any_indicator.html",
)


class StudentEvaluationForm(forms.ModelForm):
class Meta:
model = StudentEvaluation
exclude = []

labels = {
"overall_rating": _("Bitte bewerte deine Erfahrung mit match4healthcare insgesamt!"),
"registration_feedback": _(
"Hier hast du die Möglichkeit, uns allgemeines Feedback zum"
" Registrierungsprozess auf match4healthcare zu geben."
),
"suggested_improvements": _(
"Falls du allgemeine Verbesserungsvorschläge hast,"
" dann kannst du sie hier loswerden"
),
"likelihood_recommendation": _(
"Wie hoch ist die Wahrscheinlichkeit, dass du unsere Seite weiterempfehlen" "wirst?"
),
"contact_mail": _(
"Hier kannst du deine Mail angeben, falls du uns für potentiell auftretende"
" Rückfragen bezüglich deiner Evaluation zur Verfügung stehen möchtest."
),
"communication_with_institutions": _(
"Wie lief für dich die Kommunikation mit den Institutionen?"
),
}

widgets = {
"registration_feedback": forms.Textarea(attrs={"rows": 4}),
"communication_with_institutions": forms.Textarea(attrs={"rows": 4}),
"suggested_improvements": forms.Textarea(attrs={"rows": 4}),
}

def __init__(self, *args, **kwargs):
super(StudentEvaluationForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_id = "id-exampleForm"
self.helper.form_class = "blueForms"
self.helper.form_method = "post"
self.helper.form_action = "student"

self.helper.layout = Layout(
make_button_group("overall_rating"),
"registration_feedback",
"communication_with_institutions",
"suggested_improvements",
make_button_group("likelihood_recommendation"),
"contact_mail",
)

def clean_overall_rating(self):
if not self.cleaned_data["overall_rating"]:
raise forms.ValidationError(_("Bitte gib eine Gesamtbewertung ab!"), code="invalid")
return True


class InstitutionEvaluationForm(forms.ModelForm):
class Meta:
model = InstitutionEvaluation
exclude = []

labels = {
"institution_type": _(
"Bitte wählen Sie die am besten zutreffende Beschreibung für Ihre "
"Institution aus."
),
"overall_rating": _(
"Bitte bewerten Sie Ihre Erfahrung mit match4healthcare insgesamt."
),
"registration_feedback": _(
"Hier haben Sie die Möglichkeit, uns Feedback zum Registrierungsprozess auf"
" match4healthcare zu geben."
),
"suggested_improvements": _(
"Falls Sie allgemeine Verbesserungsvorschläge haben, können Sie diese hier"
" anbringen."
),
"likelihood_recommendation": _(
"Wie hoch ist die Wahrscheinlichkeit, dass Sie unsere Seite weiterempfehlen"
" werden?"
),
"contact_mail": _(
"Falls Sie uns als Ansprechpartner für weitere Rückfragen bezüglich Ihrer Evaluation"
" zur Verfügung stehen möchten, geben Sie bitte hier Ihre Kontakt E-Mail-Adresse an."
),
"communication_with_students": _(
"Wie lief für Sie die Kommunikation mit den Helfenden?"
),
}

widgets = {
"registration_feedback": forms.Textarea(attrs={"rows": 4}),
"communication_with_institutions": forms.Textarea(attrs={"rows": 4}),
"suggested_improvements": forms.Textarea(attrs={"rows": 4}),
}

def __init__(self, *args, **kwargs):
super(InstitutionEvaluationForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_id = "id-exampleForm"
self.helper.form_class = "blueForms"
self.helper.form_method = "post"
self.helper.form_action = "student"

self.helper.layout = Layout(
"institution_type",
make_button_group("overall_rating"),
"registration_feedback",
"communication_with_institutions",
"suggested_improvements",
make_button_group("likelihood_recommendation"),
"contact_mail",
)

def clean_overall_rating(self):
if not self.cleaned_data["overall_rating"]:
raise forms.ValidationError(
_("Bitte geben Sie eine Gesamtbewertung ab!"), code="invalid"
)
return True
21 changes: 21 additions & 0 deletions backend/apps/evaluation/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 3.0.5 on 2020-04-13 09:41

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='StudentEvaluation',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in this project we have never used verbose_name before. This usage here is straight-forward, but it could create confusion with the additional translation layer later on and the separate setting of labels in the form class. I'm thinking about whether this is helping or complicating the understanding in other code files.

('test', models.CharField(default='', max_length=50)),
n-hackert marked this conversation as resolved.
Show resolved Hide resolved
],
),
]
62 changes: 62 additions & 0 deletions backend/apps/evaluation/migrations/0002_auto_20200424_1137.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Generated by Django 3.0.5 on 2020-04-24 09:37

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('evaluation', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='InstitutionEvaluation',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('overall_rating', models.IntegerField(blank=True, choices=[(1, 'Sehr gut'), (2, 'Gut'), (3, 'Durchschnittlich'), (4, 'Schlecht'), (5, 'Sehr schlecht')], default=3, null=True)),
('registration_feedback', models.TextField(blank=True, default='', null=True)),
('suggested_improvements', models.TextField(blank=True, default='', null=True)),
('likelihood_recommendation', models.IntegerField(blank=True, choices=[(1, 'Sehr gut'), (2, 'Gut'), (3, 'Durchschnittlich'), (4, 'Schlecht'), (5, 'Sehr schlecht')], default=3, null=True)),
('contact_mail', models.EmailField(blank=True, max_length=254, null=True)),
('institution_type', models.CharField(choices=[('hospital', 'Krankenhaus/Spital'), ('general practice', 'Arztpraxis'), ('health authority', 'Gesundheitsamt'), ('emergency medical service', 'Rettungsdienst'), ('other', 'Andere')], default='hospital', max_length=30)),
],
options={
'abstract': False,
},
),
migrations.RemoveField(
model_name='studentevaluation',
name='test',
),
migrations.AddField(
model_name='studentevaluation',
name='communication_with_institutions',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='studentevaluation',
name='contact_mail',
field=models.EmailField(blank=True, max_length=254, null=True),
),
migrations.AddField(
model_name='studentevaluation',
name='likelihood_recommendation',
field=models.IntegerField(blank=True, choices=[(1, 'Sehr gut'), (2, 'Gut'), (3, 'Durchschnittlich'), (4, 'Schlecht'), (5, 'Sehr schlecht')], default=3, null=True),
),
migrations.AddField(
model_name='studentevaluation',
name='overall_rating',
field=models.IntegerField(blank=True, choices=[(1, 'Sehr gut'), (2, 'Gut'), (3, 'Durchschnittlich'), (4, 'Schlecht'), (5, 'Sehr schlecht')], default=3, null=True),
),
migrations.AddField(
model_name='studentevaluation',
name='registration_feedback',
field=models.TextField(blank=True, default='', null=True),
),
migrations.AddField(
model_name='studentevaluation',
name='suggested_improvements',
field=models.TextField(blank=True, default='', null=True),
),
]
33 changes: 33 additions & 0 deletions backend/apps/evaluation/migrations/0003_auto_20200428_1710.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 3.0.5 on 2020-04-28 15:10

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('evaluation', '0002_auto_20200424_1137'),
]

operations = [
migrations.AlterField(
model_name='institutionevaluation',
name='likelihood_recommendation',
field=models.IntegerField(choices=[(1, 'Sehr hoch'), (2, 'Hoch'), (3, 'Mittel'), (4, 'Gering'), (5, 'Sehr gering')], default=3),
),
migrations.AlterField(
model_name='institutionevaluation',
name='overall_rating',
field=models.IntegerField(choices=[(1, 'Sehr gut'), (2, 'Gut'), (3, 'Durchschnittlich'), (4, 'Schlecht'), (5, 'Sehr schlecht')], default=3),
),
migrations.AlterField(
model_name='studentevaluation',
name='likelihood_recommendation',
field=models.IntegerField(choices=[(1, 'Sehr hoch'), (2, 'Hoch'), (3, 'Mittel'), (4, 'Gering'), (5, 'Sehr gering')], default=3),
),
migrations.AlterField(
model_name='studentevaluation',
name='overall_rating',
field=models.IntegerField(choices=[(1, 'Sehr gut'), (2, 'Gut'), (3, 'Durchschnittlich'), (4, 'Schlecht'), (5, 'Sehr schlecht')], default=3),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.0.5 on 2020-05-19 21:06

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('evaluation', '0003_auto_20200428_1710'),
]

operations = [
migrations.AddField(
model_name='institutionevaluation',
name='communication_with_students',
field=models.TextField(blank=True, null=True),
),
]
Empty file.
Loading