static/js-parsons/ui-extension/parsons-site-ui.js
function(feedback) {
    var isCorrect = ($.isArray(feedback) && feedback.length === 0) ||
                    ('feedback' in feedback && feedback.success);

    // correctly solved but collection has more exercises
    if (isCorrect && $.isFunction(PARSONS_SETTINGS.next)) {
      $("#ul-sortable").sortable("destroy");
      $("#ul-sortableTrash").sortable("destroy");
      showDialog("Good Job!", "Click OK to go to the next question.", function() {
        PARSONS_SETTINGS.next();
      });
    } else if (isCorrect) { // correct and last question
      showDialog("Good Job!", "That was the last question. Click OK to go back to main page.", function() {
        window.location = "./index.html";
      });
    } else { // not correct, show feedback
      var now = new Date(),
          penaltyTime = 0,
          feedbackText;
      if ($.isArray(feedback)) { // line-based feedback
        feedbackText = feedback.join('\n');
      } else if ('feedback' in feedback) { // execution based feedback
        feedbackText = "Some tests failed for your solution. See the Last Feedback tab for details.";
      }
      if (feedbackTimeHistory.length > 1) { // 1st and 2nd feedback can't be too fast
        // we'll go through all the times in the feedback time history
        for (var i = 0; i < feedbackTimeHistory.length; i++) {
          // check if the corresponding feedbackwindow is bigger than time between now
          // and the i:th feedback time
          if (FEEDBACK_WINDOWS[i] > now - feedbackTimeHistory[i]) {
            penaltyTime += FEEDBACK_PENALTIES[i]; // add to penalty time
          }
        }
        // if there is penalty time, disable feedback and show a message to student
        if (penaltyTime > 0) {
          disableFeedback(penaltyTime);
          feedbackText += "\n\nDue to frequent use, feedback has been disabled for a while. It will be" +
                        "available once the button turns orange again. You can still continue solving the problem.";
        }
      }
      // add the current time to the feedbak history
      feedbackTimeHistory.unshift(now);
      // make sure we have at most as many feedback times in history as we have windows
      feedbackTimeHistory = feedbackTimeHistory.slice(0, FEEDBACK_WINDOWS.length);
      showDialog("Feedback", feedbackText);
    }
  }
function(feedback) {
    var isCorrect = ($.isArray(feedback) && feedback.length === 0) ||
                    ('feedback' in feedback && feedback.success);

    // correctly solved but collection has more exercises
    if (isCorrect && $.isFunction(PARSONS_SETTINGS.next)) {
      $("#ul-sortable").sortable("destroy");
      $("#ul-sortableTrash").sortable("destroy");
      showDialog("Good Job!", "Click OK to go to the next question.", function() {
        PARSONS_SETTINGS.next();
      });
    } else if (isCorrect) { // correct and last question
      showDialog("Good Job!", "That was the last question. Click OK to go back to main page.", function() {
        window.location = "./index.html";
      });
    } else { // not correct, show feedback
      var now = new Date(),
          penaltyTime = 0,
          feedbackText;
      if ($.isArray(feedback)) { // line-based feedback
        feedbackText = feedback.join('\n');
      } else if ('feedback' in feedback) { // execution based feedback
        feedbackText = "Some tests failed for your solution. See the Last Feedback tab for details.";
      }
      if (feedbackTimeHistory.length > 1) { // 1st and 2nd feedback can't be too fast
        // we'll go through all the times in the feedback time history
        for (var i = 0; i < feedbackTimeHistory.length; i++) {
          // check if the corresponding feedbackwindow is bigger than time between now
          // and the i:th feedback time
          if (FEEDBACK_WINDOWS[i] > now - feedbackTimeHistory[i]) {
            penaltyTime += FEEDBACK_PENALTIES[i]; // add to penalty time
          }
        }
        // if there is penalty time, disable feedback and show a message to student
        if (penaltyTime > 0) {
          disableFeedback(penaltyTime);
          feedbackText += "\n\nDue to frequent use, feedback has been disabled for a while. It will be" +
                        "available once the button turns orange again. You can still continue solving the problem.";
        }
      }
      // add the current time to the feedbak history
      feedbackTimeHistory.unshift(now);
      // make sure we have at most as many feedback times in history as we have windows
      feedbackTimeHistory = feedbackTimeHistory.slice(0, FEEDBACK_WINDOWS.length);
      showDialog("Feedback", feedbackText);
    }
  }
function ( feedback ) { var isCorrect = ( $ . isArray ( feedback ) && feedback . length === 0 ) || ( 'feedback' in feedback && feedback . success ) ; // correctly solved but collection has more exercises if ( isCorrect && $ . isFunction ( PARSONS_SETTINGS . next ) ) { $ ( "#ul-sortable" ) . sortable ( "destroy" ) ; $ ( "#ul-sortableTrash" ) . sortable ( "destroy" ) ; showDialog ( "Good Job!" , "Click OK to go to the next question." , function ( ) { PARSONS_SETTINGS . next ( ) ; } ) ; } else if ( isCorrect ) { // correct and last question showDialog ( "Good Job!" , "That was the last question. Click OK to go back to main page." , function ( ) { window . location = "./index.html" ; } ) ; } else { // not correct, show feedback var now = new Date ( ) , penaltyTime = 0 , feedbackText ; if ( $ . isArray ( feedback ) ) { // line-based feedback feedbackText = feedback . join ( '\n' ) ; } else if ( 'feedback' in feedback ) { // execution based feedback feedbackText = "Some tests failed for your solution. See the Last Feedback tab for details." ; } if ( feedbackTimeHistory . length > 1 ) { // 1st and 2nd feedback can't be too fast // we'll go through all the times in the feedback time history for ( var i = 0 ; i < feedbackTimeHistory . length ; i ++ ) { // check if the corresponding feedbackwindow is bigger than time between now // and the i:th feedback time if ( FEEDBACK_WINDOWS [ i ] > now - feedbackTimeHistory [ i ] ) { penaltyTime += FEEDBACK_PENALTIES [ i ] ; // add to penalty time } } // if there is penalty time, disable feedback and show a message to student if ( penaltyTime > 0 ) { disableFeedback ( penaltyTime ) ; feedbackText += "\n\nDue to frequent use, feedback has been disabled for a while. It will be" + "available once the button turns orange again. You can still continue solving the problem." ; } } // add the current time to the feedbak history feedbackTimeHistory . unshift ( now ) ; // make sure we have at most as many feedback times in history as we have windows feedbackTimeHistory = feedbackTimeHistory . slice ( 0 , FEEDBACK_WINDOWS . length ) ; showDialog ( "Feedback" , feedbackText ) ; } }
default feedback callback handler
default feedback callback handler