Add test for auto scale and don't rescale. Use find_one when loading StorageArea so as to use caching

This commit is contained in:
Isaac Connor 2018-09-14 16:19:29 -04:00
parent 34c7ee32ee
commit 77edb8f74b
1 changed files with 4 additions and 4 deletions

View File

@ -911,7 +911,7 @@ function reScale( $dimension, $dummy ) {
$new_dimension = $dimension;
for ( $i = 1; $i < func_num_args(); $i++ ) {
$scale = func_get_arg( $i );
if ( !empty($scale) && $scale != SCALE_BASE )
if ( !empty($scale) && ($scale != 'auto') && ($scale != SCALE_BASE) )
$new_dimension = (int)(($new_dimension*$scale)/SCALE_BASE);
}
return( $new_dimension );
@ -1114,7 +1114,7 @@ function parseFilter(&$filter, $saveToSession=false, $querySep='&amp;') {
if ( ! $StorageArea ) {
for ( $j = 0; $j < count($terms); $j++ ) {
if ( isset($terms[$j]['attr']) and $terms[$j]['attr'] == 'StorageId' and isset($terms[$j]['val']) ) {
$StorageArea = new Storage($terms[$j]['val']);
$StorageArea = Storage::find_one(array('Id'=>$terms[$j]['val']));
break;
}
} // end foreach remaining term
@ -1128,7 +1128,7 @@ function parseFilter(&$filter, $saveToSession=false, $querySep='&amp;') {
if ( ! $StorageArea ) {
for ( $j = $i; $j < count($terms); $j++ ) {
if ( isset($terms[$i]['attr']) and $terms[$i]['attr'] == 'StorageId' and isset($terms[$j]['val']) ) {
$StorageArea = new Storage($terms[$i]['val']);
$StorageArea = Storage::find_one(array('Id'=>$terms[$j]['val']));
}
} // end foreach remaining term
} // end no StorageArea found yet
@ -1160,7 +1160,7 @@ function parseFilter(&$filter, $saveToSession=false, $querySep='&amp;') {
}
break;
case 'StorageId':
$StorageArea = new Storage( $value );
$StorageArea = Storage::find_one(array('Id'=>$value));
if ( $value != 'NULL' )
$value = dbEscape($value);
break;