Skip to content

Commit

Permalink
test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
roseva1 committed Mar 21, 2024
1 parent 299a3af commit c1f8259
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion turkle/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def test_index_open_assignment(self):
client.login(username='testuser', password='secret')
response = client.get(reverse('index'))
self.assertEqual(response.status_code, 200)
self.assertTrue(b'You have open' in response.content)
self.assertFalse(b'No open assignments. Accept a new task to open an assignment.' in response.content)

def test_index_open_assignment_from_inactive_batch(self):
# Don't show open tasks from inactive batches
Expand Down
10 changes: 7 additions & 3 deletions turkle/views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections import defaultdict
from datetime import datetime, timedelta, timezone
from datetime import datetime, timedelta
from functools import wraps
import logging
import urllib
Expand Down Expand Up @@ -93,11 +93,15 @@ def process_bookmark(query_dict):
for batch in batch_query.values('created_at', 'id', 'name', 'project__name'):
if request.user.is_authenticated:
user = get_user(request)
bookmark = Bookmark.objects.filter(user=user, batch__name=batch['name']).values_list('bookmarked', 'updated_at').first()
bookmark = Bookmark.objects.filter(user=user, batch__name=batch['name']).values_list(
'bookmarked', 'updated_at').first()

def format_bookmark(bookmark):
return 'checked' if bookmark[0] else ''

# Simplify the return statement
bookmark_status, bookmark_update = (format_bookmark(bookmark), bookmark[1]) if bookmark else ('', batch['created_at'])
bookmark_status, bookmark_update = (format_bookmark(bookmark), bookmark[1])\
if bookmark else ('', batch['created_at'])
else:
bookmark_status, bookmark_update = '', ''
total_tasks_available = available_task_counts[batch['id']]
Expand Down
2 changes: 1 addition & 1 deletion turkle_site/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys
import types

DEBUG = True#False
DEBUG = False
ALLOWED_HOSTS = ['*']
X_FRAME_OPTIONS = 'SAMEORIGIN'

Expand Down

0 comments on commit c1f8259

Please sign in to comment.