Commit 8133ddaf authored by Andreas Heimann's avatar Andreas Heimann

changed popularity to account for downloads and added offset backend for index

parent 85cd1adf
...@@ -84,7 +84,7 @@ class APIController extends AbstractController ...@@ -84,7 +84,7 @@ class APIController extends AbstractController
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$data = []; $data = [];
$results = $em->getRepository(Song::class)->findBy(array(), array('views' => 'DESC'), 6, 6 * $offset); $results = $em->getRepository(Song::class)->findBy(array(), array('downloads' => 'DESC', 'views' => 'DESC'), 6, 6 * $offset);
$baseUrl = $request->getScheme() . '://' . $request->getHttpHost() . $request->getBasePath(); $baseUrl = $request->getScheme() . '://' . $request->getHttpHost() . $request->getBasePath();
foreach($results as $result) { foreach($results as $result) {
......
...@@ -25,8 +25,11 @@ class IndexController extends AbstractController ...@@ -25,8 +25,11 @@ class IndexController extends AbstractController
$activePromos = $em->getRepository(Promo::class)->findBy(array('isVisible' => true), array('id' => 'DESC'), 2); $activePromos = $em->getRepository(Promo::class)->findBy(array('isVisible' => true), array('id' => 'DESC'), 2);
$resultsNewSongs = $em->getRepository(Song::class)->findBy(array(), array('id' => 'DESC'), 6); $newOffset = $request->query->get('newOffset') * 6;
$resultsPopularSongs = $em->getRepository(Song::class)->findBy(array(), array('views' => 'DESC'), 6); $popularOffset = $request->query->get('popularOffset') * 6;
$resultsNewSongs = $em->getRepository(Song::class)->findBy(array(), array('id' => 'DESC'), 6, $newOffset);
$resultsPopularSongs = $em->getRepository(Song::class)->findBy(array(), array('downloads' => 'DESC', 'views' => 'DESC'), 6, $popularOffset);
$data['promos'] = $activePromos; $data['promos'] = $activePromos;
$data['newSongs'] = $resultsNewSongs; $data['newSongs'] = $resultsNewSongs;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment