From ec3f66eebf994236d41c53ddbc09336b2837bd43 Mon Sep 17 00:00:00 2001 From: Trent Palmer Date: Mon, 23 Aug 2021 20:13:14 -0700 Subject: [PATCH] add get_themes_orderedby_cname() to database.py --- test/database.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/database.py b/test/database.py index 98e7bdb..4a7b4c1 100644 --- a/test/database.py +++ b/test/database.py @@ -2,19 +2,18 @@ from rank_hugo_themes import ( engine, Hugothemes, Hugothemes_from_gitlab, sessionmaker ) +from sqlalchemy import asc, func def get_theme_count(): session = sessionmaker(bind=engine)() theme_count = session.query(Hugothemes).count() - print(theme_count) return theme_count def get_theme_count_from_gitlab(): session = sessionmaker(bind=engine)() theme_count_from_gitlab = session.query(Hugothemes_from_gitlab).count() - print(theme_count_from_gitlab) return theme_count_from_gitlab @@ -35,6 +34,12 @@ def get_newest_update_time_from_gitlab(): return newest_commit_time +def get_themes_orderedby_cname(): + session = sessionmaker(bind=engine)() + return session.query( + Hugothemes).order_by(asc(func.lower(Hugothemes.cname))).all() + + def get_themes(): session = sessionmaker(bind=engine)() return session.query(Hugothemes).all()