From 9dcc51f2211385239b0272bdbf2466637c874f35 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Sun, 30 May 2021 10:34:01 +0300 Subject: Check-in fixes and improvements --- servo/views/checkin.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'servo/views') diff --git a/servo/views/checkin.py b/servo/views/checkin.py index 513625b..fc1719a 100644 --- a/servo/views/checkin.py +++ b/servo/views/checkin.py @@ -161,9 +161,12 @@ def init_session(request): user = get_object_or_404(User, pk=user_id) request.session['checkin_locations'] = Location.get_checkin_list() - checkin_users = User.get_checkin_group() - queryset = checkin_users.filter(location=location) - request.session['checkin_users'] = User.serialize(queryset) + try: + checkin_users = User.get_checkin_group() + queryset = checkin_users.filter(location=location) + request.session['checkin_users'] = User.serialize(queryset) + except Exception as e: + messages.error(request, _("Failed to launch check-in interface. Please check your system settings.")) request.session['checkin_user'] = user.pk request.session['checkin_location'] = location.pk @@ -351,7 +354,7 @@ def index(request): order.add_device(device, user) - note = Note(created_by=user, body=idata['issue_description']) + note = Note(created_by=user, body=idata['issue_description'], type=Note.T_PROBLEM) note.is_reported = True note.order = order note.save() @@ -385,7 +388,7 @@ def index(request): # mark down internal notes (only if logged in) if len(idata.get('notes')): - note = Note(created_by=user, body=idata['notes']) + note = Note(created_by=user, body=idata['notes'], type=Note.T_NOTE) note.is_reported = False note.order = order note.save() -- cgit v1.2.3