File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed
src/pages/academy/grading/subcomponents Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,20 @@ type Props = {
5353 questionId : number ;
5454} ;
5555
56+ const getDisplayName = (
57+ studentName ?: string | null ,
58+ team ?: {
59+ username : any ;
60+ name : string ;
61+ id : number ;
62+ } [ ]
63+ ) : string [ ] => {
64+ if ( studentName ) return [ studentName ] ;
65+ if ( team != null ) return team . map ( member => member . name ) ;
66+
67+ return [ '' ] ;
68+ } ;
69+
5670const GradingWorkspace : React . FC < Props > = props => {
5771 const navigate = useNavigate ( ) ;
5872 const { selectedTab, setSelectedTab } = useSideContent (
@@ -294,11 +308,10 @@ const GradingWorkspace: React.FC<Props> = props => {
294308 initialXp = { grading ! . answers [ questionId ] . grade . xp }
295309 xpAdjustment = { grading ! . answers [ questionId ] . grade . xpAdjustment }
296310 maxXp = { grading ! . answers [ questionId ] . question . maxXp }
297- studentNames = {
298- grading ! . answers [ questionId ] . student . name
299- ? [ grading ! . answers [ questionId ] . student . name ]
300- : grading ! . answers [ questionId ] . team ! . map ( member => member . name )
301- }
311+ studentNames = { getDisplayName (
312+ grading ! . answers [ questionId ] . student . name ,
313+ grading ! . answers [ questionId ] . team
314+ ) }
302315 studentUsernames = {
303316 grading ! . answers [ questionId ] . student . username
304317 ? [ grading ! . answers [ questionId ] . student . username ]
You can’t perform that action at this time.
0 commit comments