fix(monthly-comparison): getAllStatus 응답에 admin_checked + 상태 카운트 추가
API 응답 매핑에서 admin_checked, change_details, vacation_days 누락 수정. summary에 review_sent, change_request 카운트 추가. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -284,10 +284,12 @@ const MonthlyComparisonController = {
|
|||||||
|
|
||||||
const workers = await Model.getAllStatus(parseInt(year), parseInt(month), department_id ? parseInt(department_id) : null);
|
const workers = await Model.getAllStatus(parseInt(year), parseInt(month), department_id ? parseInt(department_id) : null);
|
||||||
|
|
||||||
let confirmed = 0, pending = 0, rejected = 0;
|
let confirmed = 0, pending = 0, rejected = 0, review_sent = 0, change_request = 0;
|
||||||
workers.forEach(w => {
|
workers.forEach(w => {
|
||||||
if (w.status === 'confirmed') confirmed++;
|
if (w.status === 'confirmed') confirmed++;
|
||||||
else if (w.status === 'rejected') rejected++;
|
else if (w.status === 'rejected') rejected++;
|
||||||
|
else if (w.status === 'review_sent') review_sent++;
|
||||||
|
else if (w.status === 'change_request') change_request++;
|
||||||
else pending++;
|
else pending++;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -295,14 +297,17 @@ const MonthlyComparisonController = {
|
|||||||
success: true,
|
success: true,
|
||||||
data: {
|
data: {
|
||||||
period: { year: parseInt(year), month: parseInt(month) },
|
period: { year: parseInt(year), month: parseInt(month) },
|
||||||
summary: { total_workers: workers.length, confirmed, pending, rejected },
|
summary: { total_workers: workers.length, confirmed, pending, rejected, review_sent, change_request },
|
||||||
workers: workers.map(w => ({
|
workers: workers.map(w => ({
|
||||||
user_id: w.user_id, worker_name: w.worker_name, job_type: w.job_type,
|
user_id: w.user_id, worker_name: w.worker_name, job_type: w.job_type,
|
||||||
department_name: w.department_name, status: w.status || 'pending',
|
department_name: w.department_name, status: w.status || 'pending',
|
||||||
confirmed_at: w.confirmed_at, reject_reason: w.reject_reason,
|
confirmed_at: w.confirmed_at, reject_reason: w.reject_reason,
|
||||||
|
change_details: w.change_details || null,
|
||||||
|
admin_checked: w.admin_checked || 0,
|
||||||
total_work_days: w.total_work_days || 0,
|
total_work_days: w.total_work_days || 0,
|
||||||
total_work_hours: parseFloat(w.total_work_hours || 0),
|
total_work_hours: parseFloat(w.total_work_hours || 0),
|
||||||
total_overtime_hours: parseFloat(w.total_overtime_hours || 0),
|
total_overtime_hours: parseFloat(w.total_overtime_hours || 0),
|
||||||
|
vacation_days: parseFloat(w.vacation_days || 0),
|
||||||
mismatch_count: w.mismatch_count || 0
|
mismatch_count: w.mismatch_count || 0
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user