Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 9336f63

Browse files
committed
maybe auto-add team leader
1 parent 6117f98 commit 9336f63

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

runestone/groupsub/js/groupsub.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class GroupSub extends RunestoneBase {
4949
s2: "User 2",
5050
s3: "User 3",
5151
s4: "User 4",
52+
s5: "User 5",
5253
}
5354
}
5455
let select = document.getElementById("assignment_group");
@@ -61,7 +62,8 @@ class GroupSub extends RunestoneBase {
6162
// Make the select element searchable with multiple selections
6263
$('.assignment_partner_select').select2({
6364
placeholder: "Select up to 4 team members",
64-
allowClear: true
65+
allowClear: true,
66+
maximumSelectionLength: this.limit
6567
});
6668

6769
}
@@ -73,7 +75,11 @@ class GroupSub extends RunestoneBase {
7375
for (let student of picker.selectedOptions) {
7476
group.push(student.value);
7577
}
76-
78+
// If the leader forgets to add themselves, add them here.
79+
let username = eBookConfig.username;
80+
if (username && !(username in group)) {
81+
group.push(username)
82+
}
7783
if (group.len > this.limit) {
7884
alert(`You may not have more than ${this.limit} students in a group`);
7985
return
@@ -86,7 +92,7 @@ class GroupSub extends RunestoneBase {
8692
for (let student of group) {
8793
for (let question of window.allComponents) {
8894
console.log(`${student} ${question}`)
89-
await question.logCurrentAnswer(student.value)
95+
await question.logCurrentAnswer(student)
9096
}
9197
}
9298

0 commit comments

Comments
 (0)