File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,6 +83,8 @@ <h2>{{ homework.title }} - Submissions</h2>
8383</ div >
8484
8585< script >
86+ const MISSING_SCORE_VALUE = - 999 ; // Used for sorting when score is missing
87+
8688function sortTable ( ) {
8789 const table = document . getElementById ( 'submissionsTable' ) ;
8890 const tbody = table . querySelector ( 'tbody' ) ;
@@ -102,8 +104,8 @@ <h2>{{ homework.title }} - Submissions</h2>
102104 } else if ( sortBy === 'score' ) {
103105 aVal = a . cells [ 2 ] . textContent . trim ( ) ;
104106 bVal = b . cells [ 2 ] . textContent . trim ( ) ;
105- aVal = aVal === '-' ? - 999 : parseFloat ( aVal ) ;
106- bVal = bVal === '-' ? - 999 : parseFloat ( bVal ) ;
107+ aVal = aVal === '-' ? MISSING_SCORE_VALUE : parseFloat ( aVal ) ;
108+ bVal = bVal === '-' ? MISSING_SCORE_VALUE : parseFloat ( bVal ) ;
107109 return bVal - aVal ; // Descending
108110 }
109111 return 0 ;
Original file line number Diff line number Diff line change @@ -187,9 +187,13 @@ <h4>Overall Results</h4>
187187 totalField . value = total ;
188188 }
189189
190- // Auto-check "passed" if total >= passing threshold
191- if ( passedCheckbox && total >= passingThreshold ) {
192- passedCheckbox . checked = true ;
190+ // Auto-check or uncheck "passed" based on total score vs passing threshold
191+ if ( passedCheckbox ) {
192+ if ( total >= passingThreshold ) {
193+ passedCheckbox . checked = true ;
194+ } else {
195+ passedCheckbox . checked = false ;
196+ }
193197 }
194198
195199 return total ;
Original file line number Diff line number Diff line change @@ -111,6 +111,8 @@ <h2>{{ project.title }} - Submissions</h2>
111111{% endif %}
112112
113113< script >
114+ const MISSING_SCORE_VALUE = - 999 ; // Used for sorting when score is missing
115+
114116function copyEmails ( ) {
115117 const emails = [
116118 { % for submission in submissions % }
@@ -155,14 +157,14 @@ <h2>{{ project.title }} - Submissions</h2>
155157 } else if ( sortBy === 'project_score' ) {
156158 aVal = a . cells [ 2 ] . textContent . trim ( ) ;
157159 bVal = b . cells [ 2 ] . textContent . trim ( ) ;
158- aVal = aVal === '-' ? - 999 : parseFloat ( aVal ) ;
159- bVal = bVal === '-' ? - 999 : parseFloat ( bVal ) ;
160+ aVal = aVal === '-' ? MISSING_SCORE_VALUE : parseFloat ( aVal ) ;
161+ bVal = bVal === '-' ? MISSING_SCORE_VALUE : parseFloat ( bVal ) ;
160162 return bVal - aVal ; // Descending
161163 } else if ( sortBy === 'total_score' ) {
162164 aVal = a . cells [ 3 ] . textContent . trim ( ) ;
163165 bVal = b . cells [ 3 ] . textContent . trim ( ) ;
164- aVal = aVal === '-' ? - 999 : parseFloat ( aVal ) ;
165- bVal = bVal === '-' ? - 999 : parseFloat ( bVal ) ;
166+ aVal = aVal === '-' ? MISSING_SCORE_VALUE : parseFloat ( aVal ) ;
167+ bVal = bVal === '-' ? MISSING_SCORE_VALUE : parseFloat ( bVal ) ;
166168 return bVal - aVal ; // Descending
167169 }
168170 return 0 ;
You can’t perform that action at this time.
0 commit comments