Skip to content

Commit

Permalink
Autofix search issue where course subject and number are not in the p…
Browse files Browse the repository at this point in the history
…roper format
  • Loading branch information
gravitylow committed Jan 19, 2016
1 parent 85f3e7e commit 86680fe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions course/views.py
Expand Up @@ -12,6 +12,7 @@
from django.contrib.auth.decorators import login_required
from tastypie.models import ApiKey
from collections import OrderedDict
import re

def search(request):
term = None
Expand Down Expand Up @@ -52,6 +53,9 @@ def search(request):
query = query.filter(crn=crn)
log['crn'] = str(crn)
if course:
match = re.search(r'([A-z]+?)([0-9]+)', course)
if match:
course = match.group(1) + ' ' + match.group(2)
query = query.filter(course__icontains=course)
log['course'] = course
if days:
Expand Down

0 comments on commit 86680fe

Please sign in to comment.