Skip to content

Commit

Permalink
min and max number comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
bazilio91 committed Dec 15, 2014
1 parent 4c13edf commit c1e0f6e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions LuaScriptBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function buildMin($query, $column)
$modelClass = $query->modelClass;
$key = $this->quoteValue($modelClass::keyPrefix() . ':a:');

return $this->build($query, "n=redis.call('HGET',$key .. pk," . $this->quoteValue($column) . ") if v==nil or n<v then v=n end", 'v');
return $this->build($query, "n=tonumber(redis.call('HGET',$key .. pk," . $this->quoteValue($column) . ")) if v==nil or n<v then v=n end", 'v');
}

/**
Expand All @@ -133,7 +133,7 @@ public function buildMax($query, $column)
$modelClass = $query->modelClass;
$key = $this->quoteValue($modelClass::keyPrefix() . ':a:');

return $this->build($query, "n=redis.call('HGET',$key .. pk," . $this->quoteValue($column) . ") if v==nil or n>v then v=n end", 'v');
return $this->build($query, "n=tonumber(redis.call('HGET',$key .. pk," . $this->quoteValue($column) . ")) if v==nil or n>v then v=n end", 'v');
}

/**
Expand Down

0 comments on commit c1e0f6e

Please sign in to comment.