瀏覽代碼

Fix missing loans

Eren Yilmaz 5 年之前
父節點
當前提交
1a6ddc294b
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      server_controller.py

+ 6 - 1
server_controller.py

@@ -125,7 +125,8 @@ def order(json_request):
 
     if sell:
         if not model.user_has_at_least_available(amount, user_id, ownable_id):
-            return BadRequest('You can not sell more than you own (this also takes into account existing sell orders and, if you are a bank, required minimum reserves at the ).')
+            return BadRequest('You can not sell more than you own (this also takes into account existing '
+                              'sell orders and, if you are a bank, required minimum reserves at the ).')
     try:
         expiry = model.current_db_timestamp() + timedelta(minutes=time_until_expiration).total_seconds()
     except OverflowError:
@@ -250,6 +251,7 @@ def buy_banking_license(json_request):
 def news(_json_request):
     return {'data': model.news()}
 
+
 def tender_calendar(_json_request):
     return {'data': model.tender_calendar()}
 
@@ -323,6 +325,9 @@ def repay_loan(json_request):
     amount = json_request['amount']
     user_id = model.get_user_id_by_session_id(json_request['session_id'])
     loan_id = json_request['loan_id']
+    if not model.user_has_loan_with_id(user_id, loan_id, ):
+        raise NotFound('Unknown loan ID.')
+
     if amount == 'all':
         amount = model.loan_remaining_amount(loan_id)
     if amount < 0: