Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

moved refresh to page load using memcache to check monthly reset

  • Loading branch information...
commit 482e3bd283138196338f372bb832f83f998bb626 1 parent ced6d37
@progrium progrium authored
View
6 app.yaml
@@ -5,11 +5,13 @@ api_version: 1
handlers:
- url: /favicon.ico
- static_files: static/favicon.ico
- upload: static/favicon.ico
+ static_files: shared/static/favicon.ico
+ upload: shared/static/favicon.ico
- url: /robots.txt
static_files: static/robots.txt
upload: static/robots.txt
+- url: /shared/static
+ static_dir: shared/static
- url: /static
static_dir: static
- url: .*
View
4 cron.yaml
@@ -1,4 +0,0 @@
-cron:
-- description: reseting points to give out
- url: /reset_points
- schedule: every 24 hours
View
26 main.py
@@ -97,6 +97,13 @@ def get(self):
user = users.get_current_user()
profile = Profile.get_by_user(user)
if user:
+ if not memcache.get('monthly:%s' % profile.key().id()):
+ profile.to_give = MONTHLY_POINTS
+ profile.gave_this_month = 0
+ profile.received_this_month = 0
+ profile.put()
+ memcache.set('monthly:%s' % profile.key().id(), True, 3600*24*30)
+
logout_url = users.create_logout_url('/')
points_remaining = "♥"*profile.to_give
points_used = "♥"*(MONTHLY_POINTS-profile.to_give)
@@ -159,30 +166,11 @@ def get(self, kudos_id):
else:
self.redirect('/')
-class CronHandler(webapp.RequestHandler):
- #def get(self):
- # self.post()
-
- def post(self):
- # check if day of month = 1
- day = datetime.datetime.today().day
- if day == 1:
- for profile in Profile.all():
- if not memcache.get('reset_%s' % profile.key().id()):
- profile.to_give = MONTHLY_POINTS
- profile.gave_this_month = 0
- profile.received_this_month = 0
- profile.put()
- memcache.set('reset_%s' % profile.key().id(), True, 3600*24)
- self.response.out.write("Finished.")
- else:
- self.response.out.write("Wrong day: %s" % day)
def main():
application = webapp.WSGIApplication([
('/', MainHandler),
('/kudos/(\d+)', CertificateHandler),
- ('/reset_points', CronHandler),
('/worker/user', UserWorker), ], debug=True)
util.run_wsgi_app(application)
2  shared
@@ -1 +1 @@
-Subproject commit 3f21159c2b8ef43ab1a65f79c6410911b9962aba
+Subproject commit 491d4a5218905c8f32361a198ea806d31cf8a393
View
BIN  static/dojo_icon.png
Deleted file not rendered
View
BIN  static/favicon.ico
Binary file not shown
View
18 static/style.css
@@ -1,8 +1,18 @@
-body { font-family: Verdana,Arial,sans-serif; margin: 0px;}
+body { font-family: arial, verdana, arial, sans-serif; margin: 0px;}
+
+
+
#wrapper { margin-left: auto; margin-right: auto; width: 700px; }
#top a:visited { color: blue;}
-#top { height: 20px; border-bottom: 1px solid #ccc; text-align: right; font-size: 12px; padding-right: 5px; padding-top: 4px; }
+#top {
+ height: 20px;
+ border-bottom: 1px solid #ccc;
+ font-size: 12px;
+ padding-right: 10px;
+ padding-top: 5px;
+ padding-left: 10px;
+}
#header { margin-left: auto; margin-right: auto; width: 670px; height: 125px;}
#header img { margin-right: 10px;}
@@ -20,7 +30,7 @@ table td { padding-left: 10px; padding-top: 4px;}
form div { margin-top: 10px; }
-label { display: block; font-size: smaller;}
+label { display: block; }
a:visited { color: blue;}
@@ -28,6 +38,6 @@ a:visited { color: blue;}
#primary { background: white; width: 660px; padding: 10px; -moz-border-radius: 8px; -webkit-border-radius: 8px;}
h4 { font-size: smaller; }
-.label { font-size: smaller; font-weight: bold; margin-top: 10px;}
+.label { margin-top: 10px;}
#content h2 { margin-bottom: 5px; margin-top: 5px;}
#content table { margin-bottom: 20px;}
View
15 templates/base.html
@@ -5,20 +5,29 @@
<link href="/static/js/jquery.autocomplete.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/jquery.autocomplete.pack.js"></script>
+ <link href='http://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="top">
+ <a href="http://mail.hackerdojo.com">Mail</a> &nbsp;&nbsp;
+ <a href="http://events.hackerdojo.com">Events</a> &nbsp;&nbsp;
+ <strong>Kudos</strong> &nbsp;&nbsp;
+ <a href="http://signs.hackerdojo.com">Signs</a> &nbsp;&nbsp;
+ <a href="http://log.hackerdojo.com">Log</a> &nbsp;&nbsp;
+ <div style="float: right;">
{% if user %}
<span><strong>{{user.email}}</strong> | <a href="{{logout_url}}">Logout</a></span>
{% else %}
<span><a style="font-weight: bold;" href="{{login_url}}">Login</a> | <a href="http://signup.hackerdojo.com/upgrade/needaccount">Need an account?</a></span>
{% endif %}
+ </div>
</div>
<div id="wrapper">
<div id="header">
- <img src="/static/dojo_icon.png" style="float: left;" />
- <h1>Hacker Dojo</h1>
- <h2 style="font-size: x-large;">Kudos <span style="color: #d50025;">&hearts;</span></h2>
+ <img src="/shared/static/logo-medium.png" style="float: right; width: 250px; padding: 20px; margin-right: -20px;" />
+ <div style="float: left;">
+ <h1 style="font-size: xx-large;">Community<br />Kudos <span style="color: #d50025;">&hearts;</span></h1>
+ </div>
</div>
<div id="content">
{% block content %}{% endblock %}
Please sign in to comment.
Something went wrong with that request. Please try again.