Questions: Change sorting

main
Igor Scheller 4 years ago
parent 48e1d9f5f8
commit 53d5f8518b

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

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

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

Loading…
Cancel
Save