From 95aadffb2e019561588e99aa0f940da150c41a96 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Mon, 11 Jul 2022 23:16:08 +0200 Subject: [PATCH] fic: Use user order to sort exercices in interface --- libfic/exercice.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libfic/exercice.go b/libfic/exercice.go index d675381d..edcae96a 100644 --- a/libfic/exercice.go +++ b/libfic/exercice.go @@ -86,7 +86,7 @@ func (t *Theme) GetExerciceByPath(epath string) (*Exercice, error) { // GetExercices returns the list of all challenges present in the database. func GetExercices() ([]*Exercice, error) { - if rows, err := DBQuery("SELECT id_exercice, id_theme, title, url_id, path, statement, overview, headline, issue, issue_kind, depend, gain, coefficient_cur, video_uri, resolution, seealso, finished FROM exercices"); err != nil { + if rows, err := DBQuery("SELECT id_exercice, id_theme, title, url_id, path, statement, overview, headline, issue, issue_kind, depend, gain, coefficient_cur, video_uri, resolution, seealso, finished FROM exercices ORDER BY path ASC"); err != nil { return nil, err } else { defer rows.Close() @@ -109,7 +109,7 @@ func GetExercices() ([]*Exercice, error) { // GetExercices returns the list of all challenges in the Theme. func (t *Theme) GetExercices() ([]*Exercice, error) { - if rows, err := DBQuery("SELECT id_exercice, id_theme, title, url_id, path, statement, overview, headline, issue, issue_kind, depend, gain, coefficient_cur, video_uri, resolution, seealso, finished FROM exercices WHERE id_theme = ?", t.Id); err != nil { + if rows, err := DBQuery("SELECT id_exercice, id_theme, title, url_id, path, statement, overview, headline, issue, issue_kind, depend, gain, coefficient_cur, video_uri, resolution, seealso, finished FROM exercices WHERE id_theme = ? ORDER BY path ASC", t.Id); err != nil { return nil, err } else { defer rows.Close()