Fix path_order => serial_number
This commit is contained in:
24
rog/views.py
24
rog/views.py
@ -2661,9 +2661,9 @@ def get_checkins(request, *args, **kwargs):
|
||||
|
||||
# チェックインデータの取得とCP情報の結合
|
||||
checkins = GpsCheckin.objects.filter(
|
||||
zekken_number=zekken_number,
|
||||
zekken=zekken_number,
|
||||
event_code=event_code
|
||||
).order_by('path_order')
|
||||
).order_by('serial_number')
|
||||
|
||||
data = []
|
||||
for c in checkins:
|
||||
@ -2687,7 +2687,7 @@ def get_checkins(request, *args, **kwargs):
|
||||
|
||||
data.append({
|
||||
'id': c.id,
|
||||
'path_order': c.path_order,
|
||||
'path_order': c.serial_number,
|
||||
'cp_number': c.cp_number,
|
||||
'sub_loc_id': location.sub_loc_id if location else f"#{c.cp_number}",
|
||||
'location_name': location.location_name if location else None,
|
||||
@ -2731,7 +2731,7 @@ def update_checkins(request):
|
||||
logger.info(f"Updating existing checkin: {checkin}")
|
||||
|
||||
# 既存レコードの更新
|
||||
checkin.path_order = update['order']
|
||||
checkin.serial_number = update['order']
|
||||
checkin.buy_flag = update.get('buy_flag', False)
|
||||
checkin.validate_location = update.get('validation', False)
|
||||
checkin.points = update.get('points', 0)
|
||||
@ -2750,9 +2750,9 @@ def update_checkins(request):
|
||||
logger.info(f"Creating new checkin: {update}")
|
||||
try:
|
||||
checkin = GpsCheckin.objects.create(
|
||||
zekken_number=zekken_number,
|
||||
zekken=zekken_number,
|
||||
event_code=event_code,
|
||||
path_order=update['order'],
|
||||
serial_number=update['order'],
|
||||
cp_number=update['cp_number'],
|
||||
validate_location=update.get('validation', False),
|
||||
buy_flag=update.get('buy_flag', False),
|
||||
@ -2770,14 +2770,14 @@ def update_checkins(request):
|
||||
|
||||
# 更新後のデータを順序付けて取得
|
||||
updated_checkins = GpsCheckin.objects.filter(
|
||||
zekken_number=zekken_number,
|
||||
zekken=zekken_number,
|
||||
event_code=event_code
|
||||
).order_by('path_order')
|
||||
).order_by('serial_number')
|
||||
|
||||
return Response({
|
||||
'status': 'success',
|
||||
'message': 'Checkins updated successfully',
|
||||
'data': [{'id': c.id, 'path_order': c.path_order} for c in updated_checkins]
|
||||
'data': [{'id': c.id, 'path_order': c.serial_number} for c in updated_checkins]
|
||||
})
|
||||
|
||||
except Exception as e:
|
||||
@ -2806,7 +2806,7 @@ def update_checkins_old(request):
|
||||
logger.info(f"Updating existing checkin: {checkin}")
|
||||
|
||||
# 既存レコードの更新
|
||||
checkin.path_order = update['order']
|
||||
checkin.serial_number = update['order']
|
||||
checkin.buy_flag = update.get('buy_flag', False)
|
||||
checkin.validate_location = update.get('validation', False)
|
||||
checkin.points = update.get('points', 0)
|
||||
@ -2825,10 +2825,10 @@ def update_checkins_old(request):
|
||||
logger.info("Creating new checkin:{update}")
|
||||
try:
|
||||
checkin = GpsCheckin.objects.create(
|
||||
zekken_number=update_base['zekken_number'],
|
||||
zekken=update_base['zekken_number'],
|
||||
event_code=update_base['event_code'],
|
||||
|
||||
path_order=update['order'],
|
||||
serial_number=update['order'],
|
||||
cp_number=update['cp_number'],
|
||||
validate_location=update.get('validation', False),
|
||||
buy_flag=update.get('buy_flag', False),
|
||||
|
||||
Reference in New Issue
Block a user