Skip to content

Commit

Permalink
feat(main.py): add response DECLARE_USER_LOSE_EVENT if user said word…
Browse files Browse the repository at this point in the history
… ending with 'NN'. fix #413 @0.5h
  • Loading branch information
みぞ@CrazyBeatCoder committed Aug 11, 2018
1 parent 77d925c commit 88b1225
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions main.py
Expand Up @@ -30,6 +30,7 @@

ASK_CONTINUE_EVENT = u'ASK_CONTINUE_EVENT'
ASK_WORD_EVENT = u'ASK_WORD_EVENT'
DECLARE_USER_LOSE_EVENT = u'DECLARE_USER_LOSE_EVENT'


class MainPage(webapp2.RequestHandler):
Expand Down Expand Up @@ -74,9 +75,17 @@ def post(self):
logging.info(queryText)
reading = infra.search_reading_from_dic(queryText)
if reading:
if infra.check_word_datastore(userId, reading):
logging.info(reading)
reading_end = reading[-1]
if reading_end == u'ン':
obj = {
u'followupEventInput': {
u'name': DECLARE_USER_LOSE_EVENT,
u'languageCode': queryResult[u'languageCode'],
}
}
elif infra.check_word_datastore(userId, reading):
infra.save_word_datastore(userId, reading)
logging.info(reading)
# FIXME: 暫定実装
word_record = infra.search_word_record_from_dic(
reading[-1])
Expand Down

0 comments on commit 88b1225

Please sign in to comment.