Commit 4ca98645 authored by Adrián Ribao's avatar Adrián Ribao
Browse files

limit rate limit units to seconds

parent ea3bc8d5
......@@ -140,8 +140,8 @@ class Campaign(models.Model):
RATE_LIMIT_CHOICES = (
(RATE_LIMIT_SECONDS, _(u'per second')),
(RATE_LIMIT_MINUTES, _(u'per minute')),
(RATE_LIMIT_HOURS, _(u'per hour')),
# (RATE_LIMIT_MINUTES, _(u'per minute')),
# (RATE_LIMIT_HOURS, _(u'per hour')),
)
# STATUS
......@@ -235,6 +235,17 @@ class Campaign(models.Model):
return '{0}/{1}'.format(
self.rate_limit_amount, self.rate_limit_interval)
@property
def rate_limit_per_second(self):
if self.rate_limit_interval == RATE_LIMIT_HOURS:
factor = 3600
elif self.rate_limit_interval == RATE_LIMIT_MINUTES:
factor = 60
elif self.rate_limit_interval == RATE_LIMIT_SECONDS:
factor = 1
return (self.rate_limit_amount / factor)
def add_contacts(self, contacts):
"""
Adds the contacts to the campaign, and check if they are not excluded.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment