Changeset 2793
- Timestamp:
- 07/16/08 07:41:46 (3 months ago)
- Files:
-
- branches/release-41/php/lib/rating_lib.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/release-41/php/lib/rating_lib.php
r2786 r2793 86 86 } 87 87 $sum = score_for($ctx, $obj_id, $datasource, $namespace); 88 if ( isset($sum) && ( $sum == '' ) ) 89 return 0; 88 90 return sprintf("%.2f", ($sum / $count)); 89 91 } … … 149 151 } 150 152 $score = score_for($ctx, $object[$datasource . '_id'], $datasource, $namespace); 151 if ( !$score && isset($default) ) 152 return $default; 153 if ( $score ) 154 return $ctx->count_format($score, $args); 155 return $score; 153 if ( !isset($score) || ( $score == '' ) ) { 154 if ( isset($default) ) 155 return $default; 156 else 157 $score = 0; 158 } 159 return $ctx->count_format($score, $args); 156 160 } 157 161 … … 202 206 } 203 207 $avg = score_avg($ctx, $object[$datasource . '_id'], $datasource, $namespace); 204 if ( $avg)208 if ( isset($avg) && ( $avg != '') ) 205 209 return $ctx->count_format($avg, $args); 206 210 return $avg; … … 221 225 } 222 226 $count = score_count($ctx, $object[$datasource . '_id'], $datasource, $namespace); 223 if ( $count)227 if ( isset($count) && ( $count != '') ) 224 228 return $ctx->count_format($count, $args); 225 229 return $count;
