Supervisor update3

This commit is contained in:
2024-10-30 06:57:51 +09:00
parent d017da17d4
commit e01d2e7ea6
3 changed files with 76 additions and 85 deletions

BIN
.DS_Store vendored

Binary file not shown.

BIN
rog/.DS_Store vendored

Binary file not shown.

View File

@ -291,15 +291,17 @@
'Authorization': `Token ${getAuthToken()}`,
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(team => {
if (team.self_rogaining) {
// セルフロゲイニングの場合
fetch(`${API_BASE_URL}/checkins/${zekkenNumber}/${eventCode}/`,
fetch(`${API_BASE_URL}/checkins/${zekkenNumber}/${eventCode}/`,{
headers: {
'Authorization': `Token ${getAuthToken()}`,
'Content-Type': 'application/json'
'Content-Type': 'application/json',
}
})
.then(response => response.json())
.then(checkins => {
const startCheckin = checkins.find(c => c.cp_number === -1);
@ -312,7 +314,7 @@
}
})
.catch(error => handleApiError(error));
;
} else {
// 通常のロゲイニングの場合
const startTime = new Date(event.start_datetime);
@ -331,10 +333,6 @@
display.classList.remove('hidden');
input.classList.add('hidden');
// 判定を入れる
}
// 判定の更新を行う補助関数
@ -379,7 +377,6 @@
}
})
.catch(error => handleApiError(error));
;
if (!response.ok) {
if (response.status === 401) {
@ -411,7 +408,6 @@
// ユーザーにエラーを表示
const select = document.getElementById('eventCode');
select.innerHTML = '<option value="">エラー: イベントの読み込みに失敗しました</option>';
}
}
@ -421,6 +417,7 @@
fetch(`${API_BASE_URL}/zekken_numbers/${eventCode}`,{
headers: {
'Authorization': `Token ${getAuthToken()}`
}
})
.then(response => response.json())
.then(data => {
@ -435,7 +432,7 @@
})
.catch(error => handleApiError(error));
});
}
// チームデータのロード
@ -447,15 +444,13 @@
'Authorization': `Token ${getAuthToken()}`
}
})
.catch(error => handleApiError(error));
;
.catch(error => handleApiError(error)),
fetch(`${API_BASE_URL}/checkins/${zekkenNumber}/${event_code}/`, {
headers: {
'Authorization': `Token ${getAuthToken()}`
}
})
.catch(error => handleApiError(error));
;
.catch(error => handleApiError(error))
]);
// 各レスポンスのステータスを個別にチェック
@ -723,7 +718,6 @@
}
})
.catch(error => handleApiError(error));
;
if (response.ok) {
const row = document.querySelector(`tr[data-id="${id}"]`);
@ -758,11 +752,11 @@
const pointCell = tr.querySelector('.point-value');
const cpNumber = tr.dataset.cpNumber;
fetch(`${API_BASE_URL}/location/${cpNumber}/`,
fetch(`${API_BASE_URL}/location/${cpNumber}/`,{
headers: {
'Authorization': `Token ${getAuthToken()}`
}
)
})
.then(response => response.json())
.then(location => {
const points = checkbox.checked ? location.checkin_point : 0;
@ -770,7 +764,7 @@
calculatePoints(); // 総合ポイントの計算
})
.catch(error => handleApiError(error));
;
}
// 審査チェックボックス更新関数
@ -785,11 +779,11 @@
points: 0
};
fetch(`${API_BASE_URL}/location/${cpNumber}/`,
fetch(`${API_BASE_URL}/location/${cpNumber}/`,{
headers: {
'Authorization': `Token ${getAuthToken()}`
}
)
})
.then(response => response.json())
.then(location => {
if (checkin.validate_location) {
@ -812,7 +806,7 @@
// updateCheckinOnServer(cpNumber, checkin);
})
.catch(error => handleApiError(error));
;
}
// 買い物チェックボックス更新関数
@ -821,11 +815,11 @@
const pointCell = tr.querySelector('.point-value');
const cpNumber = tr.dataset.cpNumber;
fetch(`${API_BASE_URL}/location/${cpNumber}/`,
fetch(`${API_BASE_URL}/location/${cpNumber}/`,{
headers: {
'Authorization': `Token ${getAuthToken()}`
}
)
})
.then(response => response.json())
.then(location => {
const points = checkbox.checked ? location.buy_point : 0;
@ -833,7 +827,6 @@
calculatePoints(); // 総合ポイントの計算
})
.catch(error => handleApiError(error));
;
}
// 買い物チェックボックス更新関数
@ -848,11 +841,11 @@
points: 0
};
fetch(`${API_BASE_URL}/location/${cpNumber}/`,
fetch(`${API_BASE_URL}/location/${cpNumber}/`,{
headers: {
'Authorization': `Token ${getAuthToken()}`
}
)
})
.then(response => response.json())
.then(location => {
if (checkin.validate_location) {
@ -868,7 +861,6 @@
calculatePoints(); // 総合ポイントの計算
})
.catch(error => handleApiError(error));
;
}
// 画像拡大表示用のモーダル関数
@ -943,7 +935,6 @@
closeModal();
})
.catch(error => handleApiError(error));
;
}
function closeModal() {
@ -1007,7 +998,8 @@
'Authorization': `Token ${getAuthToken()}`
},
body: JSON.stringify(updates)
}).then(response => {
})
.then(response => {
if (response.ok) {
alert('保存しました');
} else {
@ -1015,7 +1007,6 @@
}
})
.catch(error => handleApiError(error));
;
}
// エラーハンドリング関数