first lesson
This commit is contained in:
parent
5f599aa578
commit
f2f4d4ca05
@ -2,6 +2,8 @@ import logging
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from daemons.bot import bot
|
from daemons.bot import bot
|
||||||
|
from helpers import now
|
||||||
|
from helpers.models import UserSchema
|
||||||
from helpers.mongo import mongo
|
from helpers.mongo import mongo
|
||||||
|
|
||||||
|
|
||||||
@ -37,7 +39,10 @@ class Processor:
|
|||||||
self.message = data['request']['original_utterance'].lower()
|
self.message = data['request']['original_utterance'].lower()
|
||||||
|
|
||||||
def get_lesson_for_user(self, hse_id: int):
|
def get_lesson_for_user(self, hse_id: int):
|
||||||
for lesson in mongo.lessons_collection.find({"hse_user_id": hse_id}).sort([("begin", 1)]):
|
user = mongo.users_collection.find_one({"hse_id": hse_id})
|
||||||
|
user = UserSchema().load(user)
|
||||||
|
t = now(user)
|
||||||
|
for lesson in mongo.lessons_collection.find({"hse_user_id": hse_id, "begin": {"$gte": t}}).sort([("begin", 1)]):
|
||||||
return lesson
|
return lesson
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user