@@ -79,81 +79,118 @@ export default function PartnerPage({ students }) {
79
79
</ Box >
80
80
</ Box >
81
81
< Box >
82
- { students . filter ( ( s ) => s . status !== 'CANCELED' ) . map ( ( s ) => (
83
- < Box mb = { 8 } >
84
- < Link name = { `s-${ s . id } ` } href = { `/dash/s/${ s . token } ` } target = "_blank" >
85
- < Heading as = "h4" fontSize = "2xl" > { s . name } { s . status !== 'ACCEPTED' && `(Status: ${ s . status } )` } </ Heading >
86
- </ Link >
87
- < Accordion allowToggle >
88
- < AccordionItem >
89
- < AccordionButton >
90
- Time Management Plan ({ s . minHours } hr/week)
91
- < AccordionIcon />
92
- </ AccordionButton >
93
- < AccordionPanel pb = { 4 } >
94
- < Text > < strong > Timezone: </ strong > { s . timezone || 'Unknown' } </ Text >
95
- { ! s . timeManagementPlan ? 'Not collected' : (
96
- < List styleType = "disc" ml = { 6 } >
97
- { [ 'Sunday' , 'Monday' , 'Tuesday' , 'Wednesday' , 'Thursday' , 'Friday' , 'Saturday' ] . map ( ( day ) => (
98
- < ListItem >
99
- < strong > { day } : </ strong >
100
- { s . timeManagementPlan [ day . toLowerCase ( ) ] . map ( ( { start, end} ) => (
101
- `${ Math . floor ( start / 60 ) } :${ ( start % 60 ) . toString ( ) . padEnd ( 2 , '0' ) } `
102
- + ' to '
103
- + `${ Math . floor ( end / 60 ) } :${ ( end % 60 ) . toString ( ) . padEnd ( 2 , '0' ) } `
104
- ) ) . join ( '; ' ) }
105
- </ ListItem >
106
- ) ) }
107
- </ List >
108
- ) }
109
- </ AccordionPanel >
110
- </ AccordionItem >
82
+ { students
83
+ . filter ( ( s ) => s . status !== 'CANCELED' )
84
+ . map ( ( s ) => {
85
+ const trainingSubmissions = ( s . projects || [ ] ) . flatMap ( ( p ) => p . tags )
86
+ . filter ( ( t ) => t . trainingLink )
87
+ . map ( ( t ) => ( {
88
+ submission : s . tagTrainingSubmissions . filter ( ( ts ) => ts . tag . id === t . id ) [ 0 ] ?. url ,
89
+ ...t ,
90
+ } ) ) ;
91
+ return {
92
+ ...s ,
93
+ trainingSubmissions,
94
+ } ;
95
+ } )
96
+ . map ( ( s ) => (
97
+ < Box mb = { 8 } >
98
+ < Link name = { `s-${ s . id } ` } href = { `/dash/s/${ s . token } ` } target = "_blank" >
99
+ < Heading as = "h4" fontSize = "2xl" > { s . name } { s . status !== 'ACCEPTED' && `(Status: ${ s . status } )` } </ Heading >
100
+ </ Link >
101
+ < Accordion allowToggle >
102
+ < AccordionItem >
103
+ < AccordionButton >
104
+ Time Management Plan ({ s . minHours } hr/week)
105
+ < AccordionIcon />
106
+ </ AccordionButton >
107
+ < AccordionPanel pb = { 4 } >
108
+ < Text > < strong > Timezone: </ strong > { s . timezone || 'Unknown' } </ Text >
109
+ { ! s . timeManagementPlan ? 'Not collected' : (
110
+ < List styleType = "disc" ml = { 6 } >
111
+ { [ 'Sunday' , 'Monday' , 'Tuesday' , 'Wednesday' , 'Thursday' , 'Friday' , 'Saturday' ] . map ( ( day ) => (
112
+ < ListItem >
113
+ < strong > { day } : </ strong >
114
+ { s . timeManagementPlan [ day . toLowerCase ( ) ] . map ( ( { start, end} ) => (
115
+ `${ Math . floor ( start / 60 ) } :${ ( start % 60 ) . toString ( ) . padEnd ( 2 , '0' ) } `
116
+ + ' to '
117
+ + `${ Math . floor ( end / 60 ) } :${ ( end % 60 ) . toString ( ) . padEnd ( 2 , '0' ) } `
118
+ ) ) . join ( '; ' ) }
119
+ </ ListItem >
120
+ ) ) }
121
+ </ List >
122
+ ) }
123
+ </ AccordionPanel >
124
+ </ AccordionItem >
111
125
112
- < AccordionItem >
113
- < AccordionButton
114
- { ...getCautionColors ( ( ! s . hasProjectPreferences && ! s . skipPreferences && ! s . project ) ? 1 : 0 ) }
115
- >
116
- Project
117
- < AccordionIcon />
118
- </ AccordionButton >
119
- < AccordionPanel pb = { 4 } >
120
- { s . projects && s . projects . length > 0 ? (
121
- s . projects . map ( ( p ) => (
122
- < Match match = { p } key = { p . id } />
123
- ) )
124
- ) : (
125
- < >
126
- < Text > Preferences Submitted: { s . hasProjectPreferences ? 'yes' : 'no' } </ Text >
127
- < Text > Matched: no</ Text >
128
- </ >
129
- ) }
130
- </ AccordionPanel >
131
- </ AccordionItem >
126
+ < AccordionItem >
127
+ < AccordionButton
128
+ { ...getCautionColors ( ( s . hasProjectPreferences || s . skipPreferences || s . project ) ? 1 : 0 ) }
129
+ >
130
+ Project
131
+ < AccordionIcon />
132
+ </ AccordionButton >
133
+ < AccordionPanel pb = { 4 } >
134
+ { s . projects && s . projects . length > 0 ? (
135
+ s . projects . map ( ( p ) => (
136
+ < Match match = { p } key = { p . id } />
137
+ ) )
138
+ ) : (
139
+ < >
140
+ < Text > Preferences Submitted: { s . hasProjectPreferences ? 'yes' : 'no' } </ Text >
141
+ < Text > Matched: no</ Text >
142
+ </ >
143
+ ) }
144
+ </ AccordionPanel >
145
+ </ AccordionItem >
132
146
133
- { s . surveyResponsesAbout
134
- . sort ( ( a , b ) => {
135
- if ( DateTime . fromISO ( a . surveyOccurence . dueAt ) > DateTime . fromISO ( b . surveyOccurence . dueAt ) ) return - 1 ;
136
- if ( DateTime . fromISO ( a . surveyOccurence . dueAt ) < DateTime . fromISO ( b . surveyOccurence . dueAt ) ) return 1 ;
137
- if ( a . surveyOccurence . survey . personType === 'STUDENT' && b . surveyOccurence . survey . personType === 'MENTOR' ) return 1 ;
138
- if ( a . surveyOccurence . survey . personType === 'MENTOR' && b . surveyOccurence . survey . personType === 'STUDENT' ) return - 1 ;
139
- } )
140
- . map ( ( sr ) => (
141
147
< AccordionItem >
142
- < AccordionButton { ...getCautionColors ( sr . caution ) } >
143
- { DateTime . fromISO ( sr . surveyOccurence . dueAt ) . toLocaleString ( ) } { ' - ' }
144
- { ( sr . authorMentor || sr . authorStudent ) . id === s . id
145
- ? 'Self-Reflection'
146
- : `${ ( sr . authorMentor || sr . authorStudent ) . name } (${ sr . surveyOccurence . survey . personType === 'MENTOR' ? 'mentor' : 'peer' } )`
147
- }
148
+ < AccordionButton
149
+ { ...getCautionColors ( 1 - ( s . trainingSubmissions . filter ( ( ts ) => ts . submission ) . length / s . trainingSubmissions . length ) ) }
150
+ >
151
+ Onboarding Assignments
148
152
< AccordionIcon />
149
153
</ AccordionButton >
150
154
< AccordionPanel pb = { 4 } >
151
- < SurveyFields content = { sr . response } />
155
+ < List styleType = "disc" ml = { 6 } >
156
+ { s . trainingSubmissions . map ( ( ts ) => (
157
+ < ListItem >
158
+ < Link href = { ts . trainingLink } >
159
+ { ts . mentorDisplayName }
160
+ </ Link > :{ ' ' }
161
+ { ts . submission ? (
162
+ < Link href = { ts . submission } > Submitted</ Link >
163
+ ) : < > Missing</ > }
164
+ </ ListItem >
165
+ ) ) }
166
+ </ List >
152
167
</ AccordionPanel >
153
168
</ AccordionItem >
154
- ) ) }
155
- </ Accordion >
156
- </ Box >
169
+
170
+ { s . surveyResponsesAbout
171
+ . sort ( ( a , b ) => {
172
+ if ( DateTime . fromISO ( a . surveyOccurence . dueAt ) > DateTime . fromISO ( b . surveyOccurence . dueAt ) ) return - 1 ;
173
+ if ( DateTime . fromISO ( a . surveyOccurence . dueAt ) < DateTime . fromISO ( b . surveyOccurence . dueAt ) ) return 1 ;
174
+ if ( a . surveyOccurence . survey . personType === 'STUDENT' && b . surveyOccurence . survey . personType === 'MENTOR' ) return 1 ;
175
+ if ( a . surveyOccurence . survey . personType === 'MENTOR' && b . surveyOccurence . survey . personType === 'STUDENT' ) return - 1 ;
176
+ } )
177
+ . map ( ( sr ) => (
178
+ < AccordionItem >
179
+ < AccordionButton { ...getCautionColors ( sr . caution ) } >
180
+ { DateTime . fromISO ( sr . surveyOccurence . dueAt ) . toLocaleString ( ) } { ' - ' }
181
+ { ( sr . authorMentor || sr . authorStudent ) . id === s . id
182
+ ? 'Self-Reflection'
183
+ : `${ ( sr . authorMentor || sr . authorStudent ) . name } (${ sr . surveyOccurence . survey . personType === 'MENTOR' ? 'mentor' : 'peer' } )`
184
+ }
185
+ < AccordionIcon />
186
+ </ AccordionButton >
187
+ < AccordionPanel pb = { 4 } >
188
+ < SurveyFields content = { sr . response } />
189
+ </ AccordionPanel >
190
+ </ AccordionItem >
191
+ ) ) }
192
+ </ Accordion >
193
+ </ Box >
157
194
) ) }
158
195
</ Box >
159
196
</ Grid >
0 commit comments