regolith/classlist.py
def add_students_to_course(students, rc):
    """Add students to the course listed"""
    course = rc.client.find_one(rc.db, 'courses', {'_id': rc.course_id})
    registry = {s['_id'] for s in students}
    if rc.op == 'add':
        registry |= set(course['students'])
    elif rc.op == 'replace':
        pass
    else:
        raise ValueError('operation {0!r} nor recognized'.format(rc.op))
    course['students'] = sorted(registry)
    rc.client.update_one(rc.db, 'courses', {'_id': rc.course_id},
                         course, upsert=True)
Add students to the course listed
Add students to the course listed
Add students to the course listed
def add_students_to_course(students, rc):
    course = rc.client.find_one(rc.db, 'courses', {'_id': rc.course_id})
    registry = {s['_id'] for s in students}
    if rc.op == 'add':
        registry |= set(course['students'])
    elif rc.op == 'replace':
        pass
    else:
        raise ValueError('operation {0!r} nor recognized'.format(rc.op))
    course['students'] = sorted(registry)
    rc.client.update_one(rc.db, 'courses', {'_id': rc.course_id},
                         course, upsert=True)
def add_students_to_course ( students , rc ) : course = rc . client . find_one ( rc . db , 'courses' , { '_id' : rc . course_id } ) registry = { s [ '_id' ] for s in students } if rc . op == 'add' : registry |= set ( course [ 'students' ] ) elif rc . op == 'replace' : pass else : raise ValueError ( 'operation {0!r} nor recognized' . format ( rc . op ) ) course [ 'students' ] = sorted ( registry ) rc . client . update_one ( rc . db , 'courses' , { '_id' : rc . course_id } , course , upsert = True )
Add students to the course listed
Add students to the course listed
"""Add students to the course listed"""
students
rc