diff --git a/src/Controllers/Admin/QuestionsController.php b/src/Controllers/Admin/QuestionsController.php index f1ac77f7..8cae429c 100644 --- a/src/Controllers/Admin/QuestionsController.php +++ b/src/Controllers/Admin/QuestionsController.php @@ -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); diff --git a/src/Controllers/QuestionsController.php b/src/Controllers/QuestionsController.php index 808ea360..ccc26766 100644 --- a/src/Controllers/QuestionsController.php +++ b/src/Controllers/QuestionsController.php @@ -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); diff --git a/tests/Unit/Controllers/QuestionsControllerTest.php b/tests/Unit/Controllers/QuestionsControllerTest.php index e31d9bed..193bcdf2 100644 --- a/tests/Unit/Controllers/QuestionsControllerTest.php +++ b/tests/Unit/Controllers/QuestionsControllerTest.php @@ -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; });