Skip to content

Commit

Permalink
Merge cae44ba into e80e8e3
Browse files Browse the repository at this point in the history
  • Loading branch information
yduman committed Mar 19, 2017
2 parents e80e8e3 + cae44ba commit 73c2d27
Show file tree
Hide file tree
Showing 25 changed files with 2,791 additions and 633 deletions.
Binary file added media/jquery/chosen/chosen-sprite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/jquery/chosen/chosen-sprite@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
447 changes: 447 additions & 0 deletions media/jquery/chosen/chosen.css

Large diffs are not rendered by default.

1,269 changes: 1,269 additions & 0 deletions media/jquery/chosen/chosen.jquery.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions media/jquery/chosen/chosen.jquery.min.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions media/jquery/chosen/chosen.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
coverage==4.3.4
Django==1.10.5
django-debug-toolbar==1.6
Django==1.10.6
django-debug-toolbar==1.7
docutils==0.13.1
sqlparse==0.2.2
sqlparse==0.2.3
freezegun==0.3.8
django-formtools==2.0
10 changes: 10 additions & 0 deletions src/feedback/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,16 @@ class Meta:
fields = ('anschrift', 'fachgebiet')


CLOSE_ORDER_CHOICES = (
('ja', 'Ja'),
('nein', 'Nein')
)


class CloseOrderForm(forms.Form):
auswahl = forms.ChoiceField(choices=CLOSE_ORDER_CHOICES)


class CreateBarcodeScannEventForm(forms.ModelForm):
"""Handelt die erste haelfte von Barcode scanns"""
scanner_token = forms.CharField()
Expand Down
28 changes: 28 additions & 0 deletions src/feedback/migrations/0035_auto_20170319_1308.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-19 13:08
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('feedback', '0034_auto_20170207_1854'),
]

operations = [
migrations.AlterModelOptions(
name='barcodeallowedstate',
options={'verbose_name': 'Erlaubter Zustand', 'verbose_name_plural': 'Erlaubte Zust\xe4nde'},
),
migrations.AlterField(
model_name='barcodeallowedstate',
name='allow_state',
field=models.IntegerField(choices=[(100, 'Angelegt'), (200, 'Bestellung ge\xf6ffnet'), (300, 'Keine Evaluation'), (500, 'Bestellung liegt vor'), (600, 'Gedruckt'), (700, 'Versandt'), (800, 'B\xf6gen eingegangen'), (900, 'B\xf6gen gescannt'), (1000, 'Ergebnisse versandt')], null=True),
),
migrations.AlterUniqueTogether(
name='barcodeallowedstate',
unique_together=set([('barcode_scanner', 'allow_state')]),
),
]
30 changes: 30 additions & 0 deletions src/feedback/migrations/0036_auto_20170319_1423.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-19 14:23
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('feedback', '0035_auto_20170319_1308'),
]

operations = [
migrations.AlterField(
model_name='barcodeallowedstate',
name='allow_state',
field=models.IntegerField(choices=[(100, 'Angelegt'), (200, 'Bestellung ge\xf6ffnet'), (300, 'Keine Evaluation'), (310, 'Keine Evaluation final'), (500, 'Bestellung liegt vor'), (510, 'Bestellung wird verarbeitet'), (600, 'Gedruckt'), (700, 'Versandt'), (800, 'B\xf6gen eingegangen'), (900, 'B\xf6gen gescannt'), (1000, 'Ergebnisse versandt')], null=True),
),
migrations.AlterField(
model_name='log',
name='status',
field=models.IntegerField(choices=[(100, 'Angelegt'), (200, 'Bestellung ge\xf6ffnet'), (300, 'Keine Evaluation'), (310, 'Keine Evaluation final'), (500, 'Bestellung liegt vor'), (510, 'Bestellung wird verarbeitet'), (600, 'Gedruckt'), (700, 'Versandt'), (800, 'B\xf6gen eingegangen'), (900, 'B\xf6gen gescannt'), (1000, 'Ergebnisse versandt')], default=100),
),
migrations.AlterField(
model_name='veranstaltung',
name='status',
field=models.IntegerField(choices=[(100, 'Angelegt'), (200, 'Bestellung ge\xf6ffnet'), (300, 'Keine Evaluation'), (310, 'Keine Evaluation final'), (500, 'Bestellung liegt vor'), (510, 'Bestellung wird verarbeitet'), (600, 'Gedruckt'), (700, 'Versandt'), (800, 'B\xf6gen eingegangen'), (900, 'B\xf6gen gescannt'), (1000, 'Ergebnisse versandt')], default=100),
),
]
17 changes: 16 additions & 1 deletion src/feedback/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,9 @@ class Veranstaltung(models.Model):
STATUS_ANGELEGT = 100
STATUS_BESTELLUNG_GEOEFFNET = 200
STATUS_KEINE_EVALUATION = 300
STATUS_KEINE_EVALUATION_FINAL = 310
STATUS_BESTELLUNG_LIEGT_VOR = 500
STATUS_BESTELLUNG_WIRD_VERARBEITET = 510
STATUS_GEDRUCKT = 600
STATUS_VERSANDT = 700
STATUS_BOEGEN_EINGEGANGEN = 800
Expand All @@ -329,7 +331,9 @@ class Veranstaltung(models.Model):
(STATUS_ANGELEGT, 'Angelegt'),
(STATUS_BESTELLUNG_GEOEFFNET, 'Bestellung geöffnet'),
(STATUS_KEINE_EVALUATION, 'Keine Evaluation'),
(STATUS_KEINE_EVALUATION_FINAL, 'Keine Evaluation final'),
(STATUS_BESTELLUNG_LIEGT_VOR, 'Bestellung liegt vor'),
(STATUS_BESTELLUNG_WIRD_VERARBEITET, 'Bestellung wird verarbeitet'),
(STATUS_GEDRUCKT, 'Gedruckt'),
(STATUS_VERSANDT, 'Versandt'),
(STATUS_BOEGEN_EINGEGANGEN, 'Bögen eingegangen'),
Expand Down Expand Up @@ -557,6 +561,11 @@ def link_veranstalter(self): # @see http://stackoverflow.com/a/17948593
else:
return "Der Veranstalter Link wird erst nach dem Anlegen angezeigt"

def allow_order(self):
return self.status == Veranstaltung.STATUS_BESTELLUNG_LIEGT_VOR or \
self.status == Veranstaltung.STATUS_BESTELLUNG_GEOEFFNET or \
self.status == Veranstaltung.STATUS_KEINE_EVALUATION

def csv_to_tutor(self, csv_content):
"""Erzeuge Tutoren Objekte aus der CSV Eingabe der Veranstalter"""
input_clean = csv_content.strip()
Expand Down Expand Up @@ -663,7 +672,13 @@ class Meta:

class BarcodeAllowedState(models.Model):
barcode_scanner = models.ForeignKey(BarcodeScanner)
allow_state = models.IntegerField(choices=Veranstaltung.STATUS_CHOICES, null=True, unique=True)
allow_state = models.IntegerField(choices=Veranstaltung.STATUS_CHOICES, null=True)

class Meta:
verbose_name = 'Erlaubter Zustand'
verbose_name_plural = 'Erlaubte Zustände'
unique_together = (('barcode_scanner', 'allow_state'),)
app_label = 'feedback'


class BarcodeScannEvent(models.Model):
Expand Down
26 changes: 25 additions & 1 deletion src/feedback/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from freezegun import freeze_time

from feedback.models import get_model, Semester, Person, Veranstaltung, Einstellung, Mailvorlage
from feedback.models.base import AlternativVorname, Log, BarcodeScanner, Fachgebiet, FachgebietEmail
from feedback.models.base import AlternativVorname, Log, BarcodeScanner, Fachgebiet, FachgebietEmail, BarcodeAllowedState
from feedback.models import past_semester_orders
from feedback.models import ImportPerson, ImportCategory, ImportVeranstaltung, Kommentar
from feedback.models import Fragebogen2008, Fragebogen2009, Ergebnis2008, Ergebnis2009
Expand Down Expand Up @@ -292,6 +292,30 @@ def test_person_admin_assign_fachgebiet(self):
self.assertEqual(self.fb_p1.fachgebiet, self.fachgebiet1)


class BarcodeScanTest(TestCase):
def setUp(self):
self.barcode_scanner = BarcodeScanner.objects.create(token="LRh73Ds22", description="description1")
self.barcode_scanner2 = BarcodeScanner.objects.create(token="KHzz211d", description="description2")

def test_equal_state_onscanners(self):
try:
# Gleicher Status auf zwei Barcodescanner möglich
BarcodeAllowedState.objects.create(barcode_scanner=self.barcode_scanner,
allow_state=Veranstaltung.STATUS_GEDRUCKT)
BarcodeAllowedState.objects.create(barcode_scanner=self.barcode_scanner2,
allow_state=Veranstaltung.STATUS_GEDRUCKT)

except IntegrityError:
self.fail()

def test_same_state_onscanner(self):
BarcodeAllowedState.objects.create(barcode_scanner=self.barcode_scanner,
allow_state=Veranstaltung.STATUS_GEDRUCKT)
with self.assertRaises(IntegrityError):
BarcodeAllowedState.objects.create(barcode_scanner=self.barcode_scanner,
allow_state=Veranstaltung.STATUS_GEDRUCKT)


class VeranstaltungTest(TransactionTestCase):
def setUp(self):
self.s = []
Expand Down
Loading

0 comments on commit 73c2d27

Please sign in to comment.