Skip to content

Commit

Permalink
search in confirm
Browse files Browse the repository at this point in the history
  • Loading branch information
nahrens007 committed Mar 1, 2018
1 parent 60b0e24 commit 61b549e
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions bblearn/learn/confirmUsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
import json


def search(request, searchString):
users = request.session['all_users']
def buildListWithRadioBoxes(request, searchString):
# build list of users to display
userList = ''
for searchItem in searchString:
for user in users:
for course in request.session['selected_courses']:
userList = ''
for searchItem in searchString:
user = util.getUser(request, searchItem)
if 'availability' in user and user['availability']['available'] == 'Yes':
if('userName' in user and searchItem in user['userName'].lower()):
userList += buildUserListEntry(user)
userList += buildUserListEntry(user, course)
continue
return userList

def buildUserListEntry(user):
def buildUserListEntry(user, course):

userList = ''
userList += '<tr>'
Expand Down Expand Up @@ -48,7 +48,7 @@ def buildUserListEntry(user):
def confirmAddUsers(request):

selectedUsers = request.session['selected_users']
userList = search(request, selectedUsers)
userList = buildListWithRadioBoxes(request, selectedUsers)


context = {
Expand Down Expand Up @@ -139,7 +139,7 @@ def addToCourse(request):
html += '<td>' + userInfo['studentId'] + '</td>'
else:
html += '<td></td>'
html += '<td>Cancelled</td>'
html += '<td class="error_message">Cancelled</td>'
html += '</tr>'
continue

Expand All @@ -166,7 +166,7 @@ def addToCourse(request):
html += '<td>' + userInfo['studentId'] + '</td>'
else:
html += '<td></td>'
html += '<td>Blackboard Error!</td>'
html += '<td class="error_message">Blackboard Error!</td>'
html += '</tr>'
elif r.status_code != 201:
# 400 - Invalid request, logged in user not in same domain as user trying to add, or user is observer
Expand All @@ -191,7 +191,7 @@ def addToCourse(request):
html += '<td>' + userInfo['studentId'] + '</td>'
else:
html += '<td></td>'
html += '<td>' + response['message'] + '</td>'
html += '<td class="error_message">' + response['message'] + '</td>'
html += '</tr>'
else:
# 201 - Successful enrollment
Expand Down

0 comments on commit 61b549e

Please sign in to comment.