removed unused import and minor syntax

This commit is contained in:
venusbb
2017-11-02 17:02:00 +00:00
parent 6875ab150a
commit ad386b7d28
4 changed files with 26 additions and 18 deletions

View File

@@ -101,9 +101,9 @@ def get_free_sms_fragment_limit(service_id):
financial_year_start = request.args.get('financial_year_start')
result = dao_get_free_sms_fragment_limit_for_year(service_id, financial_year_start)
annual_billing = dao_get_free_sms_fragment_limit_for_year(service_id, financial_year_start)
if result is None:
if annual_billing is None:
# An entry does not exist in annual_billing table for that service and year. If it is a past year,
# we return the oldest entry.
# If it is the current or future years, we create an entry in the db table using the newest record,
@@ -117,14 +117,15 @@ def get_free_sms_fragment_limit(service_id):
financial_year_start = get_current_financial_year_start_year()
if int(financial_year_start) < get_current_financial_year_start_year():
result = sms_list[0] # The oldest entry
annual_billing = sms_list[0] # The oldest entry
else:
result = sms_list[-1] # The newest entry
annual_billing = sms_list[-1] # The newest entry
result = dao_create_or_update_annual_billing_for_year(service_id, result.free_sms_fragment_limit,
financial_year_start)
annual_billing = dao_create_or_update_annual_billing_for_year(service_id,
annual_billing.free_sms_fragment_limit,
financial_year_start)
return jsonify(result.serialize_free_sms_items()), 200
return jsonify(annual_billing.serialize_free_sms_items()), 200
@billing_blueprint.route('/free-sms-fragment-limit', methods=["POST"])

View File

@@ -1,7 +1,6 @@
from app import db, create_uuid
from app import db
from app.dao.dao_utils import (
transactional,
version_class
)
from app.models import AnnualBilling
from app.dao.date_util import get_current_financial_year_start_year