Commits

imelnikov  committed c221e27 Draft

order status by date

  • Participants
  • Parent commits 0789fd9

Comments (0)

Files changed (3)

 cron:
 - description: get online status
   url: /task/status
-  schedule: every 15 minutes
+  schedule: every 5 minutes
+indexes:
+
+# AUTOGENERATED
+
+# This index.yaml is automatically updated whenever the dev_appserver
+# detects that a new type of query is run.  If you want to manage the
+# index.yaml file manually, remove the above marker line (the line
+# saying "# AUTOGENERATED").  If you want to manage some indexes
+# manually, move them above the marker line.  The index.yaml file is
+# automatically uploaded to the admin console when you next deploy
+# your application using appcfg.py.
+
+- kind: Status
+  properties:
+  - name: user_id
+  - name: time
 
 import jinja2
 import os
+import datetime
 
 jinja_environment = jinja2.Environment(
     loader=jinja2.FileSystemLoader(os.path.dirname(__file__)))
 class GraphStatus(webapp2.RequestHandler):
 	def get(self):
 		user_id = USER_ID
-		statuses = Status.all().filter('user_id', user_id)
+		time = datetime.datetime.now() + datetime.timedelta(-7)
+		statuses = Status.all()\
+			.filter('user_id', user_id)\
+			.filter('time > ', time)\
+			.order('time')
 
 		template_values = {
 			'user_id': user_id,