Skip to content

Commit 9db8c02

Browse files
authored
Merge pull request ucfopen#1058 from barnesc3/user-info-update
Show instructors in Admin Reports and populate user full names in DB
2 parents 4ce5cd9 + 05bd59a commit 9db8c02

File tree

17 files changed

+953
-73
lines changed

17 files changed

+953
-73
lines changed

INSTALL_CANVAS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ We strongly recommend you enforce scopes with your API key. The following scopes
4646
* url:PUT|/api/v1/courses/:id
4747
* url:GET|/api/v1/courses/:id
4848
* url:POST|/api/v1/courses/:course_id/files
49+
* url:GET|/api/v1/courses/:course_id/users
4950
* discussion_topics
5051
* url:GET|/api/v1/courses/:course_id/discussion_topics
5152
* url:PUT|/api/v1/courses/:course_id/discussion_topics/:topic_id
@@ -78,6 +79,10 @@ We strongly recommend you enforce scopes with your API key. The following scopes
7879
* url:GET|/api/v1/courses/:course_id/pages
7980
* url:GET|/api/v1/courses/:course_id/pages/:url_or_id
8081
* url:PUT|/api/v1/courses/:course_id/pages/:url_or_id
82+
83+
* enrollments_api
84+
* url:GET|/api/v1/courses/:course_id/enrollments
85+
*
8186

8287
---
8388
## Create an LTI Developer Key

assets/js/Components/Admin/AdminApp.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,29 @@ export default function AdminApp(initialData) {
9292
}, [filters])
9393

9494
const handleCourseUpdate = (courseData) => {
95-
let tempCourses = Object.assign({}, courses)
96-
tempCourses[courseData.id] = courseData
95+
let tempCourses = {...courses}
96+
97+
// If there's an oldId, this is a newly scanned course that needs the old entry removed
98+
if (courseData.oldId && courseData.oldId !== courseData.id) {
99+
// Remove the old unscanned course entry
100+
if (tempCourses[courseData.oldId]) {
101+
delete tempCourses[courseData.oldId]
102+
}
103+
104+
// Add the new scanned course entry
105+
const updatedCourse = {...courseData}
106+
delete updatedCourse.oldId // Remove the signal flag
107+
tempCourses[courseData.id] = updatedCourse
108+
}
109+
// If updating an existing course, just update its data
110+
else if (tempCourses[courseData.id]) {
111+
tempCourses[courseData.id] = {...tempCourses[courseData.id], ...courseData}
112+
}
113+
// If it's a new course, add it
114+
else {
115+
tempCourses[courseData.id] = courseData
116+
}
117+
97118
setCourses(tempCourses)
98119
}
99120

assets/js/Components/Admin/AdminFilters.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ export default function AdminFilters({
6969
<select
7070
id="inputAccount"
7171
disabled={loadingContent}
72+
value={filters.accountId.toString()}
7273
onChange={(e) => handleAccountSelect(e.target.value)}
7374
>
7475
{accountOptions.map((acct, i) => {
7576
return (
7677
<option
7778
key={`acct-${i}`}
7879
value={acct.id}
79-
selected={filters.accountId.toString() === acct.id.toString()}
80-
>
80+
>
8181
{acct.name}
8282
</option>
8383
)
@@ -93,15 +93,15 @@ export default function AdminFilters({
9393
<select
9494
id="inputTerm"
9595
disabled={loadingContent}
96+
value={filters.accountId.toString()}
9697
onChange={(e) => handleTermSelect(e.target.value)}
9798
>
9899
{termOptions.map((term, i) => {
99100
return (
100101
<option
101102
key={`term-${i}`}
102103
value={term.id}
103-
selected={filters.termId.toString() === term.id.toString()}
104-
>
104+
>
105105
{term.name}
106106
</option>
107107
)

0 commit comments

Comments
 (0)