Commit 3016ca8f authored by bongo0594's avatar bongo0594
Browse files

Name filtering

parent 1c697e41
......@@ -52,6 +52,9 @@ def setup_parser_pt(parser_pt):
help='Filter for a specific group')
parser_pt.add_argument('-r', '--role',
help='Only list participants with a specified role.')
parser_pt.add_argument('-n', '--name',
help='Filter for students with the given string in their name')
def main():
......@@ -132,10 +132,11 @@ def main(args):
print('Login Successful', file=sys.stderr)
l = list(
filter(lambda p: len(p.groups) > 0 or not args.grouped,
filter(lambda p: in p.groups or is None,
filter(lambda p: args.role in p.roles or args.role is None,
get_participants(s, args.course_id)))))
filter(lambda p: is None or in p.fullname,
filter(lambda p: not args.grouped or len(p.groups) > 0,
filter(lambda p: is None or in p.groups,
filter(lambda p: args.role is None or args.role in p.roles,
get_participants(s, args.course_id))))))
if args.json:
l = list(
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment