Skip to content

Commit

Permalink
Merge pull request #1271 from concord-consortium/187154175-anonymized…
Browse files Browse the repository at this point in the history
…-student-name-format

Use more readable format for anonymized student names in offering details
  • Loading branch information
pjanik committed Apr 3, 2024
2 parents 34db474 + b5c9853 commit f92aa97
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rails/app/assets/javascripts/react-components.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const offeringDetailsMapping = (data, researcher) => {
reportUrl: data.report_url,
externalReports: externalReportsArrayMapping(data.external_reports, researcher),
reportableActivities: data.reportable_activities && data.reportable_activities.map(a => reportableActivityMapping(a)),
students: data.students.map(s => studentMapping(s)).sort(sortByName)
students: data.students.map(s => studentMapping(s, researcher)).sort(sortByName)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ const detailedProgressMapping = data => ({
feedback: data.feedback && feedbackMapping(data.feedback)
})

export const studentMapping = data => ({
export const studentMapping = (data, researcher = false) => ({
id: data.user_id,
name: data.last_name + ', ' + data.first_name,
// In the researcher view (anonymized), the .name is presented in a more readable and anonymized format,
// e.g., "Student 123" instead of "123, Student".
name: researcher ? data.name : data.last_name + ', ' + data.first_name,
lastRun: data.last_run && new Date(data.last_run),
totalProgress: data.total_progress,
startedActivity: data.started_activity,
Expand Down

0 comments on commit f92aa97

Please sign in to comment.