#39: Fixed a typing issue with database results.

This commit is contained in:
Peter Deltchev 2015-12-18 05:33:30 -08:00
parent 851dfff921
commit c99ec8fc54

View file

@ -614,17 +614,17 @@ class Track extends Model
*/ */
public function getStatusAttribute(){ public function getStatusAttribute(){
return $this->trackFiles->reduce(function($carry, $trackFile){ return $this->trackFiles->reduce(function($carry, $trackFile){
if($trackFile->status === TrackFile::STATUS_PROCESSING_ERROR) { if((int) $trackFile->status === TrackFile::STATUS_PROCESSING_ERROR) {
return static::STATUS_ERROR; return static::STATUS_ERROR;
} elseif ( } elseif (
$carry !== static::STATUS_ERROR && $carry !== static::STATUS_ERROR &&
$trackFile->status === TrackFile::STATUS_PROCESSING) { (int) $trackFile->status === TrackFile::STATUS_PROCESSING) {
return static::STATUS_PROCESSING; return static::STATUS_PROCESSING;
} elseif ( } elseif (
!in_array($carry, [static::STATUS_ERROR, static::STATUS_PROCESSING]) && !in_array($carry, [static::STATUS_ERROR, static::STATUS_PROCESSING]) &&
$trackFile->status === TrackFile::STATUS_NOT_BEING_PROCESSED (int) $trackFile->status === TrackFile::STATUS_NOT_BEING_PROCESSED
) { ) {
return static::STATUS_COMPLETE; return static::STATUS_COMPLETE;