Skip to content

Commit

Permalink
63 - Unanswered Questions Part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
jmitchel3 committed Jul 23, 2015
1 parent d3da5ac commit 270caf5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Binary file modified src/db.sqlite3
Binary file not shown.
9 changes: 6 additions & 3 deletions src/questions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ def single(request, id):
user_answer.their_importance = "Not Important"
user_answer.save()

next_q = Question.objects.all().order_by("?").first()
return redirect("question_single", id=next_q.id)

next_q = Question.objects.get_unanswered(request.user).order_by("?")
if next_q.count() > 0:
next_q_instance = next_q.first()
return redirect("question_single", id=next_q_instance.id)
else:
return redirect("home")

context = {
"form": form,
Expand Down

0 comments on commit 270caf5

Please sign in to comment.