Skip to content

Commit

Permalink
Merge pull request #4734 from NCI-Agency/AB1080-improvements-advisor-…
Browse files Browse the repository at this point in the history
…interlocutors-calendar

Improve advisors-interlocutors calendar option
  • Loading branch information
gjvoosten authored Apr 17, 2024
2 parents b54e882 + f362ee6 commit 5674031
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
6 changes: 6 additions & 0 deletions client/src/components/ReportCalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ const GQL_GET_REPORT_LIST = gql`
uuid
name
}
advisorOrg {
uuid
shortName
longName
identificationCode
}
interlocutorOrg {
uuid
shortName
Expand Down
24 changes: 14 additions & 10 deletions client/src/components/aggregations/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,19 +216,23 @@ export const GET_CALENDAR_EVENTS_FROM = {
export function reportsToEvents(reports, showInterlocutors) {
return reports
.map(r => {
const who = showInterlocutors
? (r.primaryInterlocutor &&
new Person(r.primaryInterlocutor).toString()) ||
""
: (r.primaryAdvisor && new Person(r.primaryAdvisor).toString()) || ""
const where =
(r.interlocutorOrg && r.interlocutorOrg.shortName) ||
(r.location && r.location.name) ||
""
// If no other data available title is the location name
let title = `@${r.location?.name}`
const primaryPerson = showInterlocutors
? r.primaryInterlocutor
: r.primaryAdvisor
if (primaryPerson) {
// We have a primary person and therefore also an organization
const primaryOrg = showInterlocutors ? r.interlocutorOrg : r.advisorOrg
title = `${primaryOrg.shortName}: ${new Person(
primaryPerson
).toString()}`
}

const start = new Date(r.engagementDate)
start.setSeconds(0, 0) // truncate at the minute part
return {
title: who + "@" + where,
title,
start,
end: moment(start).add(r.duration, "minutes").toDate(),
url: Report.pathFor(r),
Expand Down

0 comments on commit 5674031

Please sign in to comment.