Commit 4ceabd66 authored by Cyril Matthey-Doret's avatar Cyril Matthey-Doret
Browse files

add example one-liners for group management

parent 6f3ed146
Pipeline #329418 passed with stage
in 10 seconds
......@@ -113,9 +113,9 @@ python collect_forks.py \
"group": "demo-group",
"members": [
{
"username": "studenta",
"name": "Student A",
"email": student.a@email.here
"username": "smcstudent",
"name": "Student McStudent",
"email": student.mcstudent@email.here
}
],
"commit": "0175894cf61fe820fdb84e5c52fc7ee0259a3c71",
......@@ -162,6 +162,7 @@ After grading student assignments, the teacher may want to send student groups t
<details>
<summary> <b>Read more...</b> </summary>
script: [teach\_utils/send\_feedback.py](teach_utils/send_feedback.py)
**usage**:
......
# Extracting group information with one liners
This document lists a few one liners to extract useful group information from the JSON output of `collect_forks.json`.
* Find the number of groups
```sh
$ jq 'length' forks.json
20
```
* Get all groups with fewer than 3 students
```sh
$ jq '
.[] \
| {"group": .group, "size": (.members | length)} \
| select(.size < 3)' forks.json
{
"group": "group-w",
"size": 1
}
```
* Find all students present in multiple groups
```sh
$ jq '.[] | .members | map(.name) | .[]' forks.json \
| sort \
| uniq -dc
2 "Student McStudent"
```
* Find students without group (using an external list of names)
```sh
# 1. Get the list of students in groups, sort it
# 2. Sort the list of all enrolled students
# 3. Find names which are in enrolled students, but not grouped students
jq '.[] | .members | map(.name) | .[]' forks.json \
| sort \
| uniq -d \
| sed 's/^ *//' \
| comm -23 <( sort enrolled_students.txt) -
"John Smith"
```
\ No newline at end of file
Markdown is supported
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