Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
owlester12 committed Dec 22, 2024
1 parent f3bf26b commit 65c2d22
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions frontend/components/Settings/WhartonApplicationStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,39 +33,37 @@ function parseStatuses(statuses: ApplicationStatus[]): PieChartData {
const applicationCommittees = {}
const applicationsGrouped: PieChartData = {}
statuses.forEach((status) => {
if (!(status.name in applicationCommittees)) {
if (!(status.club in applicationCommittees)) {
const total = {}
Object.keys(colors).forEach((status) => (total[status] = 0))
applicationsTotal[status.name] = total
applicationsTotal[status.club] = total

applicationCommittees[status.name] = {}
applicationCommittees[status.club] = {}
}
if (!(status.committee in applicationCommittees[status.name])) {
applicationCommittees[status.name][status.committee] = {}
if (!(status.committee in applicationCommittees[status.club])) {
applicationCommittees[status.club][status.committee] = {}
}
if (
!(status.status in applicationCommittees[status.name][status.committee])
!(status.status in applicationCommittees[status.club][status.committee])
) {
applicationCommittees[status.name][status.committee][status.status] = 0
applicationCommittees[status.club][status.committee][status.status] = 0
}
applicationsTotal[status.name][status.status] += status.count
applicationCommittees[status.name][status.committee][status.status] +=
applicationsTotal[status.club][status.status] += status.count
applicationCommittees[status.club][status.committee][status.status] +=
status.count
})

/* Does application name even matter? */

Object.keys(applicationCommittees).forEach((name) => {
Object.keys(applicationCommittees[name]).forEach((committee) => {
Object.keys(applicationCommittees[name][committee]).forEach((status) => {
if (!(name in applicationsGrouped)) {
applicationsGrouped[name] = {}
Object.keys(applicationCommittees).forEach((club) => {
Object.keys(applicationCommittees[club]).forEach((committee) => {
Object.keys(applicationCommittees[club][committee]).forEach((status) => {
if (!(club in applicationsGrouped)) {
applicationsGrouped[club] = {}
}
if (!(committee in applicationsGrouped[name])) {
applicationsGrouped[name][committee] = []
if (!(committee in applicationsGrouped[club])) {
applicationsGrouped[club][committee] = []
}
applicationsGrouped[name][committee].push({
angle: applicationCommittees[name][committee][status],
applicationsGrouped[club][committee].push({
angle: applicationCommittees[club][committee][status],
label: status,
color: colors[status],
})
Expand Down

0 comments on commit 65c2d22

Please sign in to comment.