Fixed problems with canceled orders
This commit is contained in:
parent
c405a49366
commit
f4ebc83a9b
12
ext.py
12
ext.py
|
@ -35,16 +35,21 @@ class Order:
|
||||||
self.sponsorship = None
|
self.sponsorship = None
|
||||||
self.has_early = False
|
self.has_early = False
|
||||||
self.has_late = False
|
self.has_late = False
|
||||||
self.first_name = None
|
self.first_name = "None"
|
||||||
self.last_name = None
|
self.last_name = "None"
|
||||||
self.country = 'xx'
|
self.country = 'xx'
|
||||||
self.address = None
|
self.address = None
|
||||||
self.checked_in = False
|
self.checked_in = False
|
||||||
self.room_type = None
|
self.room_type = None
|
||||||
self.daily = False
|
self.daily = False
|
||||||
self.dailyDays = []
|
self.dailyDays = []
|
||||||
|
self.bed_in_room = -1
|
||||||
self.room_person_no = 0
|
self.room_person_no = 0
|
||||||
self.answers = []
|
self.answers = []
|
||||||
|
self.position_id = -1
|
||||||
|
self.position_positionid = -1
|
||||||
|
self.position_positiontypeid = -1
|
||||||
|
self.barcode = "None"
|
||||||
|
|
||||||
idata = data['invoice_address']
|
idata = data['invoice_address']
|
||||||
if idata:
|
if idata:
|
||||||
|
@ -106,6 +111,9 @@ class Order:
|
||||||
self.phone = data['phone']
|
self.phone = data['phone']
|
||||||
self.room_errors = []
|
self.room_errors = []
|
||||||
self.loadAns()
|
self.loadAns()
|
||||||
|
|
||||||
|
if(self.bed_in_room < 0):
|
||||||
|
self.status = "canceled" # Must refer to the previous status assignment
|
||||||
def loadAns(self):
|
def loadAns(self):
|
||||||
self.shirt_size = self.ans('shirt_size')
|
self.shirt_size = self.ans('shirt_size')
|
||||||
self.is_artist = True if self.ans('is_artist') != 'No' else False
|
self.is_artist = True if self.ans('is_artist') != 'No' else False
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from sanic.log import logger, logging
|
from sanic.log import logger, logging
|
||||||
from logging import LogRecord
|
from logging import LogRecord
|
||||||
from config import *
|
from config import *
|
||||||
|
import traceback
|
||||||
|
|
||||||
METRICS_REQ_NO = 0
|
METRICS_REQ_NO = 0
|
||||||
METRICS_ERR_NO = 0 # Errors served to the clients
|
METRICS_ERR_NO = 0 # Errors served to the clients
|
||||||
|
@ -61,6 +62,8 @@ def getRoomCountersText(request):
|
||||||
if(order.daily):
|
if(order.daily):
|
||||||
daily += 1
|
daily += 1
|
||||||
else:
|
else:
|
||||||
|
# Order.status must reflect the one in the Order() constructor inside ext.py
|
||||||
|
if(order.status in ["pending", "paid"] and hasattr(order, "bed_in_room") and order.bed_in_room in counters):
|
||||||
counters[order.bed_in_room] += 1
|
counters[order.bed_in_room] += 1
|
||||||
if(order.has_early):
|
if(order.has_early):
|
||||||
counters_early[order.bed_in_room] += 1
|
counters_early[order.bed_in_room] += 1
|
||||||
|
@ -76,7 +79,8 @@ def getRoomCountersText(request):
|
||||||
out.append(f'webint_order_room_counter{{label="Daily"}} {daily}')
|
out.append(f'webint_order_room_counter{{label="Daily"}} {daily}')
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(traceback.format_exc())
|
||||||
|
|
||||||
logger.warning("Error in loading metrics rooms")
|
logger.warning("Error in loading metrics rooms")
|
||||||
return "\n".join(out)
|
return "\n".join(out)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue