diff --git a/aula/models.py b/aula/models.py index f82b662..b27a83a 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] @@ -145,7 +160,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() @@ -174,7 +189,7 @@ class User(tuple, UserMixin): conn.commit() cur.close() - def get_allh_threads(self): + def get_all_threads(self): cur = conn.cursor() sql_call = """ 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 {