Questions: Change sorting

This commit is contained in:
Igor Scheller 2020-12-20 20:45:49 +01:00
parent 48e1d9f5f8
commit 53d5f8518b
3 changed files with 4 additions and 3 deletions

View File

@ -66,7 +66,7 @@ class QuestionsController extends BaseController
public function index(): Response
{
$questions = $this->question
->orderBy('answer')
->orderBy('answered_at')
->orderByDesc('created_at')
->get();
$this->cleanupModelNullValues($questions);

View File

@ -63,7 +63,8 @@ class QuestionsController extends BaseController
{
$questions = $this->question
->whereUserId($this->auth->user()->id)
->orderByDesc('created_at')
->orderByDesc('answered_at')
->orderBy('created_at')
->get();
$this->cleanupModelNullValues($questions);

View File

@ -35,7 +35,7 @@ class QuestionsControllerTest extends ControllerTest
$this->assertEquals('pages/questions/overview.twig', $view);
$this->assertArrayHasKey('questions', $data);
$this->assertEquals('Lorem?', $data['questions'][0]->text);
$this->assertEquals('Foo?', $data['questions'][0]->text);
return $this->response;
});