From 9a35d8cbc8d7155ce1f9c7b9072f51c351af51a4 Mon Sep 17 00:00:00 2001 From: Asger Date: Thu, 26 May 2022 15:27:59 +0200 Subject: [PATCH 1/2] Chaged few typo's and ORDER BY in query --- aula/models.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/aula/models.py b/aula/models.py index a7925bc..cab5abf 100644 --- a/aula/models.py +++ b/aula/models.py @@ -102,6 +102,21 @@ class Thread(tuple): self.creator_id = thread_data[3] super().__init__() + def get_message(self): + cur = conn.cursor() + sql_call = """ + SELECT * FROM message + WHERE message.thread_id = %s.thread_id + """ + cur.execute(sql_call, (self.group_id,)) + Thread = Thread(cur.fetchall()) if cur.rowcount > 0 else None + result = [] + for thread_data in Thread: + result.append(Thread(thread_data)) + cur.close() + return result + + class User(tuple, UserMixin): def __init__(self, user_data): self.user_id = user_data[0] @@ -135,7 +150,7 @@ class User(tuple, UserMixin): SELECT groups.* FROM groups INNER JOIN users_groups ON groups.group_id = users_groups.group_id WHERE users_groups.user_id = %s UNION SELECT groups.* FROM groups WHERE groups.hidden = TRUE - ORDER BY hidden DESC, name DESC + ORDER BY hidden ASC, name DESC """ cur.execute(sql_call, (self.user_id,)) groups = cur.fetchall() @@ -164,7 +179,7 @@ class User(tuple, UserMixin): conn.commit() cur.close() - def get_allh_threads(self): + def get_all_threads(self): cur = conn.cursor() sql_call = """ From 4325a153425a827e52c57e918a5c2e62393da1e1 Mon Sep 17 00:00:00 2001 From: NikolajDanger Date: Thu, 26 May 2022 15:28:56 +0200 Subject: [PATCH 2/2] :sparkles: --- aula/static/main.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aula/static/main.css b/aula/static/main.css index ca425f8..9240c7a 100644 --- a/aula/static/main.css +++ b/aula/static/main.css @@ -50,7 +50,7 @@ h1, h2, h3, h4, h5, h6 { } .navbar-brand { - height: 80px; + height: 75px; margin-bottom: 5px; } @@ -62,11 +62,11 @@ h1, h2, h3, h4, h5, h6 { color: #cbd5db; font-weight: 700; width: 100px; - height: 100px; + height: 80px; margin-top: 0; margin-bottom: 0; text-align: center; - padding-top: 35px; + padding-top: 25px; } .site-header .navbar-nav .nav-link:hover {