mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
35 lines
770 B
Python
Executable file
35 lines
770 B
Python
Executable file
#!/usr/bin/env python3
|
|
|
|
from sqlalchemy import and_
|
|
|
|
import aurweb.config
|
|
|
|
from aurweb import db, time
|
|
from aurweb.models import TUVoteInfo
|
|
from aurweb.scripts import notify
|
|
|
|
notify_cmd = aurweb.config.get('notifications', 'notify-cmd')
|
|
|
|
|
|
def main():
|
|
db.get_engine()
|
|
|
|
now = time.utcnow()
|
|
|
|
start = aurweb.config.getint("tuvotereminder", "range_start")
|
|
filter_from = now + start
|
|
|
|
end = aurweb.config.getint("tuvotereminder", "range_end")
|
|
filter_to = now + end
|
|
|
|
query = db.query(TUVoteInfo.ID).filter(
|
|
and_(TUVoteInfo.End >= filter_from,
|
|
TUVoteInfo.End <= filter_to)
|
|
)
|
|
for voteinfo in query:
|
|
notif = notify.TUVoteReminderNotification(voteinfo.ID)
|
|
notif.send()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|