@@ -20,6 +20,9 @@ const DetailedGradesTable = ({ intl }) => {
2020 sectionScores,
2121 } = useModel ( 'progress' , courseId ) ;
2222
23+ const { course, isMasquerading } = useModel ( 'courseHomeMeta' , courseId ) ;
24+ const isStaff = course ?. isStaff ;
25+
2326 const isLocaleRtl = isRtl ( getLocale ( ) ) ;
2427 const showUngradedAssignments = (
2528 getConfig ( ) . SHOW_UNGRADED_ASSIGNMENT_PROGRESS === 'true'
@@ -30,7 +33,6 @@ const DetailedGradesTable = ({ intl }) => {
3033 const subsectionScores = chapter . subsections . filter (
3134 ( subsection ) => ! ! (
3235 ( showUngradedAssignments || subsection . hasGradedAssignment )
33- && subsection . showGrades
3436 && ( subsection . numPointsPossible > 0 || subsection . numPointsEarned > 0 )
3537 ) ,
3638 ) ;
@@ -39,10 +41,34 @@ const DetailedGradesTable = ({ intl }) => {
3941 return null ;
4042 }
4143
42- const detailedGradesData = subsectionScores . map ( ( subsection ) => ( {
43- subsectionTitle : < SubsectionTitleCell subsection = { subsection } /> ,
44- score : < span className = { subsection . learnerHasAccess ? '' : 'greyed-out' } > { subsection . numPointsEarned } { isLocaleRtl ? '\\' : '/' } { subsection . numPointsPossible } </ span > ,
45- } ) ) ;
44+ const detailedGradesData = subsectionScores . map ( ( subsection ) => {
45+ let scoreDisplay ;
46+
47+ if ( subsection . showCorrectness === 'never' ) {
48+ scoreDisplay = 'This score is hidden.' ;
49+ } else if (
50+ ! isStaff && ! isMasquerading
51+ && ( subsection . showCorrectness === 'past_due' || subsection . showCorrectness === 'never_but_include_grade' )
52+ && Date . parse ( subsection . due ) > Date . now ( )
53+ ) {
54+ const formattedDate = intl . formatDate ( new Date ( subsection . due ) , {
55+ year : 'numeric' ,
56+ month : 'short' ,
57+ day : 'numeric' ,
58+ hour : 'numeric' ,
59+ minute : 'numeric' ,
60+ timeZoneName : 'short' ,
61+ } ) ;
62+ scoreDisplay = `Score will appear at ${ formattedDate } ` ;
63+ } else {
64+ scoreDisplay = `${ subsection . numPointsEarned } ${ isLocaleRtl ? '\\' : '/' } ${ subsection . numPointsPossible } ` ;
65+ }
66+
67+ return {
68+ subsectionTitle : < SubsectionTitleCell subsection = { subsection } /> ,
69+ score : < span className = { subsection . learnerHasAccess ? '' : 'greyed-out' } > { scoreDisplay } </ span > ,
70+ } ;
71+ } ) ;
4672
4773 return (
4874 < div className = "my-3" key = { `${ chapter . displayName } -grades-table` } >
0 commit comments