Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed multi-email, and zombie jobs

  • Loading branch information...
commit e4e63f8227a1c485dcc50b8433fbcbbc48c1afdf 1 parent 1de9491
@thenoviceoof authored
Showing with 20 additions and 2 deletions.
  1. +7 −2 admin.py
  2. +13 −0 models.py
View
9 admin.py
@@ -39,17 +39,22 @@ def get(self):
# check if the jobs are past their event date
flyers = set([j.flyer for j in jobs])
for flyer in flyers:
- if current_date > flyer.event_date.replace(tzinfo=CurrentTimeZone()):
+ flyer_date = flyer.event_date.replace(tzinfo=CurrentTimeZone())
+ if current_date > flyer_date:
flyer.active = False
flyer.put()
for job in jobs:
if not(job.flyer.active):
job.active = False
job.put()
- jobs = [j for j in jobs if j.active]
+ # only get the un-done jobs
+ jobs = [j for j in jobs if j.active and j.state != 2]
# send the emails: bin jobs by email, send
emails = set([j.email for j in jobs])
+ logging.info(str(jobs))
+ logging.info(str(emails))
+
# !!!
# email sending pre-computation
domain = "http://%s.appspot.com" % get_application_id()
View
13 models.py
@@ -35,6 +35,19 @@ class Email(db.Model):
created_at = db.DateTimeProperty(auto_now_add=True)
updated_at = db.DateTimeProperty(auto_now_add=True)
+ # here so we can set together email objects
+ def __hash__(self):
+ return self.email.__hash__()
+ def __eq__(self, other):
+ if isinstance(other, Email):
+ return self.email == other.email
+ return NotImplemented
+ def __ne__(self, other):
+ result = self.__eq__(other)
+ if result is NotImplemented:
+ return result
+ return not result
+
class Flyer(db.Model):
# stores the hash in a easy to access place
id = db.StringProperty()
Please sign in to comment.
Something went wrong with that request. Please try again.