Fix Bug: lat/lon is undefined

Brightcells 6 年 前
コミット
de95f6073c
共有1 個のファイルを変更した7 個の追加2 個の削除を含む
  1. 7 2
      page/sale_views.py

+ 7 - 2
page/sale_views.py

@@ -24,8 +24,8 @@ def clerk_sale_submit_api(request):
24 24
     user_id = request.POST.get('user_id', '')
25 25
     iv = request.POST.get('iv', '')
26 26
     encryptedData = request.POST.get('encryptedData', '')
27
-    lat = float(request.POST.get('lat', 0))
28
-    lon = float(request.POST.get('lon', 0))
27
+    lat = request.POST.get('lat', .0)
28
+    lon = request.POST.get('lon', .0)
29 29
     brandID = request.POST.get('BrandID', settings.KODO_DEFAULT_BRAND_PK)
30 30
     modelID = request.POST.get('ModelID', '')
31 31
     distributorID = request.POST.get('DistributorID', '')
@@ -39,6 +39,11 @@ def clerk_sale_submit_api(request):
39 39
 
40 40
     test_sn = serialNo in settings.TESTING_SNS
41 41
 
42
+    if lat == 'undefined':
43
+        lat = .0
44
+    if lon == 'undefined':
45
+        lon = .0
46
+
42 47
     try:
43 48
         user = UserInfo.objects.get(user_id=user_id, status=True)
44 49
     except UserInfo.DoesNotExist: