final stage update bugs

This commit is contained in:
2024-11-08 14:33:46 +09:00
parent 9eb45d7e97
commit d22e8b5a23
7 changed files with 108 additions and 84 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -113,6 +113,10 @@ class SumasenExcel:
self.basic = basic
self.output_path = basic.get("output_path")
if not os.path.exists(self.output_path):
os.makedirs(self.output_path, exist_ok=True)
logging.info("step-2")
# basicセクションから必要なパラメータを取得
@ -143,7 +147,7 @@ class SumasenExcel:
logging.error("sections not found in basic section")
# 出力ファイルパスを設定
self.output_filepath = f"{self.docpath}/{doc_file}"
self.output_filepath = f"{self.output_path}/{doc_file}"
# 新規のExcelワークブックを作成
self.workbook = openpyxl.Workbook()
# デフォルトで作成されるシートを削除

View File

@ -4,6 +4,7 @@ doc_file=certificate_[zekken_number].xlsx
sections=section1
maxcol=10
column_width=3,5,16,16,16,16,16,8,8,12,3
output_path=media/reports/[event_code]
[section1]
template_sheet=certificate

View File

@ -134,8 +134,7 @@ FROM
AND CAST(e.zekken_number AS TEXT) = cs.zekken_number
LEFT JOIN v_category_rankings cr ON e.id = cr.id
LEFT JOIN rog_member m ON t.id = m.team_id
LEFT JOIN rog_goalimages gi ON ev.event_name = gi.event_code
AND CAST(e.zekken_number AS TEXT) = gi.zekken_number
LEFT JOIN rog_goalimages gi ON e.owner_id = gi.user_id
GROUP BY
e.id, e.zekken_number, e.is_active, e."hasParticipated", e."hasGoaled", e.date,
@ -177,6 +176,7 @@ SELECT
FROM
gps_checkins g
LEFT JOIN rog_location l ON g.cp_number = l.cp
AND l."group" LIKE '%' || g.event_code || '%'
ORDER BY
g.event_code,
g.zekken_number,

View File

@ -2561,7 +2561,7 @@ def update_checkins(request):
checkin.buy_flag = update.get('buy_flag', False)
checkin.validate_location = update.get('validation', False)
checkin.points = update.get('points', 0)
checkin.update_at = timezone.now()
# checkin.update_at = timezone.now() チェックイン時刻は更新しない
checkin.update_user = request.user.email if request.user.is_authenticated else None
checkin.save()
logger.info(f"Updated existing checkin result: {checkin}")
@ -2583,7 +2583,7 @@ def update_checkins(request):
validate_location=update.get('validation', False),
buy_flag=update.get('buy_flag', False),
points=update.get('points', 0),
create_at=timezone.now(),
# create_at=timezone.now(), チェックイン時刻は更新しない
update_at=timezone.now(),
create_user=request.user.email if request.user.is_authenticated else None,
update_user=request.user.email if request.user.is_authenticated else None

View File

@ -253,6 +253,16 @@
try {
const newTime = new Date(input.value);
// inputがnullの場合は棄権処理
if (!input) {
const validateElement = document.getElementById('validate');
display.textContent = '棄権';
if (validateElement) {
validateElement.textContent = '棄権';
}
return;
}
display.textContent = newTime.toLocaleString();
const eventCodeSelect = document.getElementById('eventCode');
@ -322,6 +332,7 @@
}
}
});
calculatePoints(); // 総合ポイントの計算
} catch (e) {
console.error('Error updating goal time:', e);
@ -453,6 +464,8 @@
'未ゴール';
goalTimeDisplay.textContent = goalTime;
updateGoalTime(goalTime) // ゴール時刻の表示を更新
console.info('teamData.goal_photo = ',teamData.goal_photo );
if (goalTime === '-') {
@ -510,7 +523,11 @@
`<img src="/media/compressed/${checkin.photos}" class="h-20 w-20 object-cover rounded" onclick="showLargeImage(this.src)">` : ''}
</td>
<td class="px-2 py-3">
${checkin.cp_number===-1 || checkin.image_address===null ? "" : `<img src="${checkin.image_address}" class="h-20 w-20 object-cover rounded" onclick="showLargeImage(this.src)">`}
${checkin.cp_number===-1 || checkin.image_address===null ? "" :
`<img src="${checkin.image_address}"
class="h-20 w-20 object-cover rounded"
onclick="showLargeImage(this.src)"
onerror="this.parentElement.innerHTML=''">`}
</td>
<td class="px-2 py-3 ${bgColor}">
<div class="font-bold">${checkin.sub_loc_id}</div>
@ -996,6 +1013,7 @@ function applyImageOrientation(imgElement) {
let totalPoints = 0; // チェックインポイントの合計をクリア
let cpPoints = 0; // チェックインポイントの合計をクリア
let buyPoints = 0; // 買い物ポイントの合計をクリア
let latePoints = 0; // 遅刻ポイントの合計をクリア
// 各行のチェックインポイント及び買い物ポイントを合算
rows.forEach(row => {
@ -1013,7 +1031,7 @@ function applyImageOrientation(imgElement) {
});
// 遅刻ポイントの計算=ゴール時刻がEventのゴール時刻を超えていたら分につき-50点を加算する。
const latePoints = parseInt(document.getElementById('latePoints').textContent) || 0;
latePoints = parseInt(document.getElementById('latePoints').textContent) || 0;
// 総合得点を計算
const finalPoints = totalPoints + latePoints;
@ -1022,6 +1040,7 @@ function applyImageOrientation(imgElement) {
document.getElementById('totalPoints').textContent = cpPoints;
document.getElementById('buyPoints').textContent = buyPoints;
document.getElementById('latePoints').textContent = latePoints;
document.getElementById('finalPoints').textContent = finalPoints;
}