much better fix for #1082

This commit is contained in:
Thomas Citharel
2015-02-16 15:18:24 +01:00
parent 467503fb2a
commit cdee5e6570
2 changed files with 12 additions and 11 deletions

View File

@ -393,13 +393,12 @@ class Poche
/* For some unknown reason I can't get displayView() to work here (it redirects to home view afterwards). So here's a dirty fix which redirects directly to URL */
case 'random':
$count = $this->store->getEntriesByViewCount($view, $this->user->getId());
$id_query = $this->store->getRandomId(rand(1,$count)-1, $this->user->getId());
$id = $id_query[0];
Tools::logm('get a random article');
Tools::redirect('?view=view&id=' . $id[0]);
//$this->displayView('view', $id);
if ($this->store->getRandomId($this->user->getId())) {
$id = $this->store->getRandomId($this->user->getId())[0];
Tools::redirect('?view=view&id=' . $id[0]);
Tools::logm('got the article with id ' . $id[0]);
}
break;
default:
break;