Fix Location2025 checkin_radius issue
This commit is contained in:
@ -1114,6 +1114,13 @@ class Location2025Admin(LeafletGeoAdmin):
|
||||
|
||||
def evaluation_value_display(self, obj):
|
||||
"""evaluation_valueのカスタム表示"""
|
||||
# CP番号による特別な表示
|
||||
if obj.cp_number == -2:
|
||||
return 'スタート'
|
||||
elif obj.cp_number == -1:
|
||||
return 'ゴール'
|
||||
|
||||
# evaluation_valueによる通常の表示
|
||||
evaluation_map = {
|
||||
'0': '通常CP',
|
||||
'1': '買物CP',
|
||||
|
||||
@ -1236,6 +1236,21 @@ class Location2025(models.Model):
|
||||
hidden_str = row.get('hidden_location', '').lower()
|
||||
hidden_location = hidden_str in ['true', '1', 'yes', 'on']
|
||||
|
||||
# checkin_radiusの処理
|
||||
checkin_radius = None
|
||||
if row.get('checkin_radius'):
|
||||
radius_str = row.get('checkin_radius', '').strip()
|
||||
if radius_str and radius_str.lower() not in ['false', '', 'null']:
|
||||
try:
|
||||
checkin_radius = float(radius_str)
|
||||
except ValueError:
|
||||
# デフォルト値を設定
|
||||
checkin_radius = -1.0 # 要タップ
|
||||
else:
|
||||
checkin_radius = -1.0 # CSVでFALSEや空の場合は要タップ
|
||||
else:
|
||||
checkin_radius = -1.0 # デフォルトは要タップ
|
||||
|
||||
defaults = {
|
||||
# 基本フィールド
|
||||
'cp_name': row.get('loc_name', row.get('cp_name', f'CP{cp_number}')),
|
||||
@ -1247,6 +1262,7 @@ class Location2025(models.Model):
|
||||
'address': row.get('address', ''),
|
||||
'phone': row.get('phone', ''),
|
||||
'description': row.get('description', row.get('remark', '')),
|
||||
'checkin_radius': checkin_radius, # チェックイン範囲を追加
|
||||
|
||||
# 新しいフィールド
|
||||
'sub_loc_id': row.get('sub_loc_id', ''),
|
||||
|
||||
Reference in New Issue
Block a user