Skip to content

Commit

Permalink
fix(dev): repair is_ta boolean in get_user_classes
Browse files Browse the repository at this point in the history
is_ta appears to be no longer sent in the networks list of
'user.status', so instead we use the 'profs_hash' to check for TA
status.
  • Loading branch information
skystrife committed Aug 14, 2018
1 parent cbb46df commit 5deffec
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions piazza_api/piazza.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,16 @@ def get_user_classes(self):
# raw_classes = self.get_user_profile().get('all_classes').values()

# Get classes from the user status (includes all classes)
raw_classes = self.get_user_status().get('networks', [])
status = self.get_user_status()
uid = status['id']
raw_classes = status.get('networks', [])

classes = []
for rawc in raw_classes:
c = {k: rawc[k] for k in ['name', 'term']}
c['num'] = rawc.get('course_number', '')
c['nid'] = rawc['id']
c['is_ta'] = rawc.get('is_ta', False)
c['is_ta'] = uid in rawc['prof_hash']
classes.append(c)

return classes
Expand Down

0 comments on commit 5deffec

Please sign in to comment.