@@ -41,6 +41,8 @@ var pagination = {
4141 questions : { page : 0 , perPage : 50 } ,
4242} ;
4343var questionsToDelete = [ ] ;
44+ var keepSegment = null ;
45+ var fromAwaitingScoring = false ;
4446
4547var draggableQuestionList = null ;
4648var draggableSegmentReorder = null ;
@@ -498,6 +500,8 @@ try {
498500 filteredSegments . forEach ( segment => {
499501 document . getElementById ( "filter-segment-input" ) . innerHTML += `<option value="${ segment . id } " ${ ( document . location . search . split ( '?segment=' ) [ 1 ] && ( document . location . search . split ( '?segment=' ) [ 1 ] === String ( segment . id ) ) ) ? 'selected' : '' } >${ segment . number } - ${ segment . name } ${ segment . due ? ` (Due ${ new Date ( `${ segment . due } T00:00:00` ) . toLocaleDateString ( 'en-US' , { weekday : 'short' , year : 'numeric' , month : 'short' , day : 'numeric' } ) } )` : '' } </option>` ;
500502 } ) ;
503+ if ( keepSegment ) document . getElementById ( "filter-segment-input" ) . value = keepSegment ;
504+ keepSegment = null ;
501505 }
502506 const coursesArchiveTab = document . querySelector ( '[data-archive-type="courses"]' ) ;
503507 if ( coursesArchiveTab ) {
@@ -2329,6 +2333,11 @@ try {
23292333 document . querySelectorAll ( '[data-edit-reason]' ) . forEach ( a => a . addEventListener ( 'click' , editReason ) ) ;
23302334 document . querySelectorAll ( '[report]' ) . forEach ( a => a . addEventListener ( 'click' , toggleDetailedReport ) ) ;
23312335 document . querySelectorAll ( '[data-select]' ) . forEach ( a => a . addEventListener ( 'click' , toggleSelected ) ) ;
2336+ if ( fromAwaitingScoring && ! awaitingResponses . length && document . getElementById ( "filter-segment-input" ) ) {
2337+ document . getElementById ( "filter-segment-input" ) . value = '' ;
2338+ fromAwaitingScoring = false ;
2339+ updateResponses ( ) ;
2340+ }
23322341 if ( ! loadedSegmentEditor && ! loadedSegmentCreator ) ui . setUnsavedChanges ( false ) ;
23332342 ui . reloadUnsavedInputs ( ) ;
23342343 }
@@ -2481,6 +2490,8 @@ try {
24812490 ui . setUnsavedChanges ( false ) ;
24822491 ui . toast ( "Successfully updated status." , 3000 , "success" , "bi bi-check-lg" ) ;
24832492 noReloadCourse = true ;
2493+ keepSegment = document . getElementById ( "filter-segment-input" ) . value ;
2494+ fromAwaitingScoring = ( document . querySelector ( '.awaitingResponses .section' ) && Array . from ( document . querySelector ( '.awaitingResponses .section' ) . children ) . includes ( this . parentElement ) ) ? true : false ;
24842495 init ( ) ;
24852496 } )
24862497 . catch ( ( e ) => {
@@ -2561,6 +2572,8 @@ try {
25612572 reason : reason
25622573 } ;
25632574 noReloadCourse = true ;
2575+ keepSegment = document . getElementById ( "filter-segment-input" ) . value ;
2576+ fromAwaitingScoring = ( document . querySelector ( '.awaitingResponses .section' ) && Array . from ( document . querySelector ( '.awaitingResponses .section' ) . children ) . includes ( e . parentElement ) ) ? true : false ;
25642577 init ( ) ;
25652578 } )
25662579 . catch ( ( e ) => {
0 commit comments