Use routing quota instead of monthly quota

This commit is contained in:
Mario de Frutos
2018-03-14 11:19:48 +01:00
parent 07ed2a4112
commit f652a52a8d
2 changed files with 4 additions and 7 deletions

View File

@@ -153,7 +153,7 @@ class RoutingConfig(ServiceConfig):
elif self._routing_provider == self.MAPBOX_PROVIDER:
self._mapbox_api_keys = self._db_config.mapbox_routing_api_keys
self._mapbox_service_params = self._db_config.mapbox_routing_service_params
self._set_monthly_quota()
self._routing_quota = self._get_effective_monthly_quota(self.QUOTA_KEY)
self._set_soft_limit()
self._period_end_date = date_parse(self._redis_config[self.PERIOD_END_DATE])
@@ -193,8 +193,8 @@ class RoutingConfig(ServiceConfig):
return self._mapbox_service_params
@property
def monthly_quota(self):
return self._monthly_quota
def routing_quota(self):
return self._routing_quota
@property
def period_end_date(self):
@@ -204,9 +204,6 @@ class RoutingConfig(ServiceConfig):
def soft_limit(self):
return self._soft_limit
def _set_monthly_quota(self):
self._monthly_quota = self._get_effective_monthly_quota(self.QUOTA_KEY)
def _set_soft_limit(self):
if self.SOFT_LIMIT_KEY in self._redis_config and self._redis_config[self.SOFT_LIMIT_KEY].lower() == 'true':
self._soft_limit = True

View File

@@ -122,7 +122,7 @@ class QuotaChecker:
return False
def __check_routing_quota(self):
user_quota = self._user_service_config.monthly_quota
user_quota = self._user_service_config.routing_quota
today = date.today()
service_type = self._user_service_config.service_type
current_used = self._user_service.used_quota(service_type, today)