This repository has been archived by the owner on Mar 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Evaluation student #422
Draft
n-hackert
wants to merge
41
commits into
match4everyone:staging
Choose a base branch
from
n-hackert:evaluation_student
base: staging
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Evaluation student #422
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 d2547df
Added url mapping to evaluation app
n-hackert ac4244e
Added Dummy-Model and View
n-hackert 4033577
Added basic(est) permission check to student-evaluation form and eval…
n-hackert 8ac3414
migrations
n-hackert db52494
Revert changes to scripts and docker-compose
n-hackert 04ef4d4
Merge remote-tracking branch 'upstream/staging' into evaluation_student
n-hackert 71c7f2c
Merge branch 'staging' into evaluation_student
Baschdl bdf30a2
Merge remote-tracking branch 'upstream/staging' into evaluation_student
n-hackert 8aca609
Removed permission checks for evaluation
n-hackert f776b39
Removed obsolete migration
n-hackert ce60729
Added evaluation models for institutions and students
n-hackert b63318b
shortened URL
n-hackert 6fb782c
Added StudentEvaluationForm
n-hackert 26eafab
Added Completed URL; added Name to URL-Mappings
n-hackert 5e84c47
Small model related fixes
n-hackert d43cc65
Fixed Form and added Template
n-hackert cf503e8
Added form to views.py
n-hackert 8699fdf
Added basic "Completed" Template
n-hackert a261e94
Merge remote-tracking branch 'upstream/staging' into evaluation_student
n-hackert bfea9be
Improved form layout and redirect
n-hackert 6705100
Improved form layout and redirect
n-hackert 68c8555
Improved Form layout Vol 2
n-hackert ddd8227
Improved eval model
n-hackert f9d7ca5
Implemented skeleton for institution eval
n-hackert 2d53737
Migrations
n-hackert 56fe700
Merge branch 'staging' into evaluation_student
Baschdl 7bf120c
Merge branch 'staging' into evaluation_student
Baschdl 7b92bf4
Merge branch 'staging' into evaluation_student
Baschdl 596ebfc
Merge branch 'staging' into evaluation_student
Baschdl 02d786d
Delete migration because already on staging
Baschdl b45f805
Merge branch 'staging' into evaluation_student
Baschdl ac77117
Merge remote-tracking branch 'upstream/staging' into evaluation_student
n-hackert 9fd3f78
Completed form and model for institution eval
n-hackert bb1dcb6
Migrations
n-hackert 444d7b0
Small fixes
n-hackert 47a2b0b
Added referer check to thank you page
n-hackert 8c1a133
Added translations
n-hackert 0b1f532
Merge branch 'staging' into evaluation_student
Baschdl 021fcbb
Fix translations
Baschdl 6530c2c
Format code with pre-commit
Baschdl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class EvaluationConfig(AppConfig): | ||
name = "evaluation" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')), | ||
('test', models.CharField(default='', max_length=50)), | ||
n-hackert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
], | ||
), | ||
] |
62 changes: 62 additions & 0 deletions
62
backend/apps/evaluation/migrations/0002_auto_20200424_1137.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
33
backend/apps/evaluation/migrations/0003_auto_20200428_1710.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), | ||
), | ||
] |
18 changes: 18 additions & 0 deletions
18
backend/apps/evaluation/migrations/0004_institutionevaluation_communication_with_students.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.