mirror of
https://github.com/TrentSPalmer/hugo_themes_report.git
synced 2024-12-04 16:41:31 -08:00
add get_themes_orderedby_cname() to database.py
This commit is contained in:
parent
466b1e6e3a
commit
ec3f66eebf
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user