Skip to content

Commit

Permalink
fix(infra.py): fix to used datestore. ref #402 @0.25h
Browse files Browse the repository at this point in the history
  • Loading branch information
hayatedayon committed Jul 30, 2018
1 parent 40e116f commit 67b2384
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@


class User(ndb.Model):
user_id = ndb.StringProperty()
words = ndb.TextProperty()
last_word = ndb.TextProperty()
count = ndb.IntegerProperty()
Expand Down Expand Up @@ -61,9 +60,8 @@ def save_word_datastore(user_id, save_word):
user.words += u',' + save_word
user.count += 1
except Exception:
user = User()
user.user_id = user_id
user.words += save_word
user = User(id=user_id)
user.words = save_word
user.count = 1
user.last_word = save_word
user.put()
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def post(self):
queryResult = obj[u'queryResult']
originalDetectIntentRequest = obj['originalDetectIntentRequest']
intentDisplayName = queryResult[u'intent'][u'displayName']
userId = originalDetectIntentRequest[u'user'][u'userId']
userId = originalDetectIntentRequest[u'payload'][u'user'][u'userId']

self.response.headers['Content-Type'] = 'application/json'
if intentDisplayName == GOOGLE_ASSISTANT_WELCOME_INTENT:
Expand Down

0 comments on commit 67b2384

Please sign in to comment.