diff --git a/backend/TE/AppDB.php b/backend/TE/AppDB.php index d39325b9b37d726c8f895d82c4d54d6e44a52cc1..1228de4e9e662752cd14703b8d660c3f1f45d394 100644 --- a/backend/TE/AppDB.php +++ b/backend/TE/AppDB.php @@ -287,12 +287,6 @@ class AppDB_TE extends AppDB ); } - // TODO: merge this function and the getUserAssignments in a single one, the difference - // being that here we fetch the user data (name, id and groups). And of course that this - // function selects assignments by exercise, whereas getUserAssignments does so by - // user, obviously. - // Otherwise, the SQL code and the post-processing a too similar to be two totally - // different beasts. public function getExerciseAssignments( $id, $extended = false, $anonymousreview = 0, $multiCaseViewer = NULL ) { $this->checkAdmin(); @@ -1634,69 +1628,6 @@ class AppDB_TE extends AppDB ORDER BY rank DESC;" ); return $res; } - public function getAllConclusions( $exid, $step = NULL, $type = NULL, $anonymousreview = NULL, $multiCaseViewer = NULL ) - { - $this->checkAdmin(); - - return $this->getExerciseAssignments( $exid, true, $anonymousreview, $multiCaseViewer ); - - $columns = array ( - 'object.creator AS uid', - 'observationtype.name', - 'observation.value' - ); - $from = array ( - 'object', - 'assignment', - 'observationtype', - 'observation' - ); - - $multiCaseViewerWhere = ""; - if( $multiCaseViewer != NULL ) - { - $multiCaseViewerAids = explode( ",", $multiCaseViewer ); - - foreach( $multiCaseViewerAids as $multiCaseViewerAid ) - { - $multiCaseViewerWhere .= " OR assignment.exercise = " . ( int ) $multiCaseViewerAid; - } - } - - $where = "object.id = assignment.id - AND ( assignment.exercise = " . ( int ) $exid . " " . $multiCaseViewerWhere . ") - AND assignment.id = observation.assignment - AND observation.type = observationtype.id"; - - if( $step ) - { - if( is_string( $step ) ) - { - $where .= " AND resultstep.id = observation.resstep AND resultstep.short ILIKE E'" . pg_escape_string( $step ) . "'"; - $from[] = 'resultstep'; - } else - $where .= " AND observation.resstep = " . ( int ) $step; - - $columns[] = 'observation.resstep AS step'; - } - - if( $type ) - { - if( is_string( $type ) ) - $where .= " AND observationtype.name = E'" . pg_escape_string( $type ) . "'"; - else - $where .= " AND observation.type = " . ( int ) $type; - } - - $sql = "SELECT " . implode( $columns, ',' ) . " - FROM " . implode( $from, ', ' ) . " - WHERE " . $where . ";"; - - throw new Exception( $sql ); - $res = $this->query( $sql ); - return $res; - } - // User views public function getHomeData() { diff --git a/backend/TE/TakeExercise.php b/backend/TE/TakeExercise.php index 4e7c75fc38ad2027b0ca2e39d28a98e5426db9c9..19700fa2ddc98fed0d869667cf6a87a9a52864be 100644 --- a/backend/TE/TakeExercise.php +++ b/backend/TE/TakeExercise.php @@ -63,6 +63,7 @@ class ExerciseFrame extends Node $rs->getPage()->addScript( $base . 'js/pianos4_report.js' ); $rs->getPage()->addScript( $base . 'js/pianos4_help.js' ); $rs->getPage()->addScript( $base . 'js/pinger.js' ); + $rs->getPage()->addScript( $base . 'js/preloader.js' ); if( Application::get( 'viewTracker' ) && ! $_SESSION[ 'user' ][ 'isadmin' ] ) $rs->getPage()->addScript( $base . 'js/viewTracker.js' ); @@ -283,7 +284,7 @@ class TakeExerciseFrame extends ExerciseFrame if( $isTutorReview ) { $moreSettings[ 'showModifiedMinutiae' ] = true; - $moreSettings[ 'getConclusionsScript' ] = '?action=rpc&method=getAllConclusions&step=' . $progress[ 'step' ] . '&exid=' . $ex[ 'id' ] . '&type=conclusion'; + $moreSettings[ 'getConclusionsScript' ] = '?action=rpc&method=getExerciseAssignments&id=' . $ex[ 'id' ] . '&extended=true'; if( isset( $_GET[ 'multiCaseViewer' ] ) ) $moreSettings[ 'getConclusionsScript' ] .= "&multiCaseViewer=" . $_GET[ 'multiCaseViewer' ]; diff --git a/js/pianos4.js b/js/pianos4.js index 1c8f0648a59b7300146db43d9b68e9cfea9a3417..2f04f178b9857c11ac091c2b241105aaef829e5e 100644 --- a/js/pianos4.js +++ b/js/pianos4.js @@ -362,6 +362,19 @@ function Pianos4( params ) if( params.onExerciseStartup ) params.onExerciseStartup( self, params ); + + // Preload some images from the analysis view + if( params.phase === "analysis" ) + { + $( document ).ready( function() + { + setTimeout( function() + { + preloader( 'css/location/main.png' ); + preloader( params.print.href, 120, 15 ); + }, 100 ); + } ); + } } // udb.app compat layer diff --git a/js/preloader.js b/js/preloader.js new file mode 100644 index 0000000000000000000000000000000000000000..f4ea0085d1a9dd28647747351f61317bcd874d66 --- /dev/null +++ b/js/preloader.js @@ -0,0 +1,10 @@ +var preloader = function( url, a = 0, b = 0 ) +{ + var delay = 1000 * ( ( Math.random() * a ) + b ); + + setTimeout( function(){ + $.ajax( { + url: url + } ); + }, delay ); +}