Update wehago matching logic and exclude reports
This commit is contained in:
@@ -1,169 +0,0 @@
|
||||
# DB Health Check 2026-04-09
|
||||
|
||||
## Summary
|
||||
|
||||
- Current SQLite size and row counts are still within a manageable range for this app.
|
||||
- Main medium-term risks were:
|
||||
- concurrent writes causing `database is locked`
|
||||
- all users sharing one `project_page_state` row
|
||||
- growing scan cost around billing-link and project-status entry access
|
||||
- These were addressed without data loss.
|
||||
|
||||
## Current Scale
|
||||
|
||||
- `transactions`: about 49k rows
|
||||
- `project_contract_info`: 760 rows
|
||||
- `project_billing_entries`: 1,774 rows
|
||||
- `project_related_links`: 1,276 rows
|
||||
- `project_status`: few rows now, but each row can contain many logical sub-entries
|
||||
|
||||
## Improvements Applied
|
||||
|
||||
### 1. SQLite concurrency and durability tuning
|
||||
|
||||
Applied on every DB connection in [main.py](/home/b17301/my-intranet-app/main.py#L39):
|
||||
|
||||
- `PRAGMA journal_mode=WAL`
|
||||
- `PRAGMA synchronous=NORMAL`
|
||||
- `PRAGMA foreign_keys=ON`
|
||||
- `PRAGMA busy_timeout=5000`
|
||||
- `PRAGMA temp_store=MEMORY`
|
||||
|
||||
Effect:
|
||||
|
||||
- better concurrent read/write behavior
|
||||
- lower chance of write collisions during multi-user editing
|
||||
- safer long-running usage than SQLite defaults
|
||||
|
||||
### 2. Added indexes for growth hotspots
|
||||
|
||||
Added in [main.py](/home/b17301/my-intranet-app/main.py#L119):
|
||||
|
||||
- `transactions`
|
||||
- `idx_transactions_support_category`
|
||||
- `idx_transactions_support_account`
|
||||
- `idx_transactions_source_file`
|
||||
- `idx_transactions_updated_at`
|
||||
- `project_billing_entries`
|
||||
- `idx_project_billing_entries_raw_code`
|
||||
- `idx_project_billing_entries_round_code`
|
||||
- `idx_project_billing_entries_source_file`
|
||||
- `idx_project_billing_entries_updated_at`
|
||||
- `project_related_links`
|
||||
- `idx_project_related_links_related`
|
||||
- `project_page_state`
|
||||
- `idx_project_page_state_page_session`
|
||||
|
||||
Effect:
|
||||
|
||||
- faster changed-round grouping
|
||||
- better support/account based project aggregations
|
||||
- faster source-file based reimport paths
|
||||
- safer scaling as billing and transaction history grows
|
||||
|
||||
### 3. Page state changed from shared row to session-scoped rows
|
||||
|
||||
The old structure used one shared record:
|
||||
|
||||
- `project_page_state(page_key PRIMARY KEY, ...)`
|
||||
|
||||
This meant different users could overwrite each other's selected project, year, and open/closed detail state.
|
||||
|
||||
It now migrates to:
|
||||
|
||||
- `project_page_state(page_key, session_id, ...)`
|
||||
- primary key: `(page_key, session_id)`
|
||||
|
||||
Relevant code:
|
||||
|
||||
- schema migration: [main.py](/home/b17301/my-intranet-app/main.py#L264)
|
||||
- load/save logic: [main.py](/home/b17301/my-intranet-app/main.py#L1970)
|
||||
- API: [main.py](/home/b17301/my-intranet-app/main.py#L3473)
|
||||
- browser session id: [templates/base.html](/home/b17301/my-intranet-app/templates/base.html#L538)
|
||||
- client page-state save/load: [templates/projects.html](/home/b17301/my-intranet-app/templates/projects.html#L4880)
|
||||
|
||||
Effect:
|
||||
|
||||
- browser A and browser B no longer fight over one shared project-search state
|
||||
|
||||
### 4. Project status JSON blobs normalized into child tables
|
||||
|
||||
Previously, logical row collections were stored only inside JSON columns in `project_status`:
|
||||
|
||||
- `collection_entries_json`
|
||||
- `task_plan_entries_json`
|
||||
- `exec_budget_entries_json`
|
||||
- `actual_input_entries_json`
|
||||
|
||||
This has now been normalized into child tables:
|
||||
|
||||
- `project_collection_entries`
|
||||
- `project_task_plan_entries`
|
||||
- `project_exec_budget_entries`
|
||||
- `project_actual_input_entries`
|
||||
|
||||
Relevant code:
|
||||
|
||||
- row extraction and migration helpers: [main.py](/home/b17301/my-intranet-app/main.py#L987)
|
||||
- child-table schema: [main.py](/home/b17301/my-intranet-app/main.py#L273)
|
||||
- migration from legacy JSON: [main.py](/home/b17301/my-intranet-app/main.py#L1201)
|
||||
- project status read paths: [main.py](/home/b17301/my-intranet-app/main.py#L2143)
|
||||
- project status save path: [main.py](/home/b17301/my-intranet-app/main.py#L3323)
|
||||
|
||||
Effect:
|
||||
|
||||
- less dependence on large JSON blobs for active reads
|
||||
- cleaner future path for per-section editing
|
||||
- safer long-term maintainability
|
||||
|
||||
## Backward Compatibility
|
||||
|
||||
Legacy JSON columns are still kept in `project_status` for compatibility and rollback safety.
|
||||
|
||||
Current behavior:
|
||||
|
||||
- reads prefer normalized child rows
|
||||
- if child rows do not exist, legacy JSON/scalar fallback still works
|
||||
- writes update both:
|
||||
- scalar summary fields
|
||||
- legacy JSON cache
|
||||
- normalized child rows
|
||||
|
||||
This avoids data loss during migration.
|
||||
|
||||
## Remaining Structural Risk
|
||||
|
||||
The biggest remaining architectural limitation is:
|
||||
|
||||
- `project_status` still acts as one large parent record for many independently editable sections
|
||||
|
||||
So while row collections are normalized now, parent-level fields such as:
|
||||
|
||||
- project type
|
||||
- expected rates
|
||||
- contract amount
|
||||
- dates
|
||||
- notes
|
||||
|
||||
still live together in one row and one update flow.
|
||||
|
||||
This is acceptable for now, but if many users edit the same project simultaneously, the next best improvement would be:
|
||||
|
||||
1. split edit APIs by section
|
||||
2. add per-section revision tracking
|
||||
3. optionally move more parent fields into section-specific tables
|
||||
|
||||
## Recommendation
|
||||
|
||||
Current DB can continue operating efficiently with the applied changes.
|
||||
|
||||
Recommended next step if the app keeps expanding:
|
||||
|
||||
- introduce section-level save endpoints for
|
||||
- collection
|
||||
- task plan
|
||||
- exec budget
|
||||
- actual input
|
||||
- project metadata
|
||||
|
||||
That would reduce cross-section write conflicts even more.
|
||||
@@ -1,23 +0,0 @@
|
||||
# 작업 요약
|
||||
|
||||
작업일: 2026-04-08
|
||||
|
||||
## 핵심 변경
|
||||
|
||||
- 프로젝트 검색 성능 저하 구간을 줄이기 위해 검색 목록 렌더 흐름을 정리하고 표시 개수를 제한했습니다.
|
||||
- 프로젝트 정보 페이지의 상세 레이아웃을 재구성해 상단 정보 카드의 중첩 박스를 제거하고 주요 지표 배치를 정리했습니다.
|
||||
- 계획 대비 실제 비교에서 인건비, 외주비, 제경비, A/S비, 판관비 세부 로직과 실제 집행 합산 기준을 여러 차례 보정했습니다.
|
||||
- 실투입 관리, 실행예산계획, 과업수행계획 입력 UI와 저장 구조를 정리했습니다.
|
||||
- 대시보드 상단을 재구성해 사업현황 요약과 수금/지출 구성 그래프를 다시 배치했습니다.
|
||||
- 프로젝트 페이지 상태 저장은 버튼 클릭 시 DB에 저장되도록 연결했습니다.
|
||||
|
||||
## 주요 파일
|
||||
|
||||
- `main.py`
|
||||
- `templates/base.html`
|
||||
- `templates/dashboard.html`
|
||||
- `templates/projects.html`
|
||||
|
||||
## 참고
|
||||
|
||||
- 템플릿 백업은 `template_backups/20260408_ko/`에 생성했습니다.
|
||||
@@ -1,50 +0,0 @@
|
||||
# 작업 요약 2026-04-09
|
||||
|
||||
## 이번 반영 범위
|
||||
|
||||
- 프로젝트 정보 페이지 안정화
|
||||
- 저장 후 프로젝트 정보 화면이 비거나 모달이 갑자기 닫히는 문제 구조 개선
|
||||
- 프로젝트 검색/상세/미계약 비용 발생 현황의 데이터 흐름 및 자동 최신화 충돌 완화
|
||||
- 바로가기, 연관 프로젝트, 세부 내역 정렬/표시 개선
|
||||
|
||||
- 사업현황 추가/수정 저장 구조 보강
|
||||
- 프로젝트 저장을 DB 기준으로 즉시 반영되도록 보강
|
||||
- 수금정보 분류값 정리
|
||||
- 기성구분: `선급금 / 기성금 / 준공금`
|
||||
- 청구구분: `계약분 / 기타`
|
||||
- 실행예산/실투입/예상 배분 설정 연계 보강
|
||||
|
||||
- 계약/청구/변경계약 데이터 반영
|
||||
- 계약현황, 기성청구현황, 변경계약금액현황(총괄/차수) 파일을 DB에 반영
|
||||
- 변경차수/보완/연계 프로젝트 자동 연결 로직 보강
|
||||
- 본계약과 연결 가능한 건은 상세 페이지와 연관 프로젝트 태그/집행내역에 합산 반영
|
||||
|
||||
- DB 구조 및 안정성 개선
|
||||
- 설정성 하드코딩 일부를 DB 설정 테이블로 이동
|
||||
- 프로젝트 입력 데이터의 섹션 분리 구조 확장
|
||||
- 건강 점검 문서 추가: `DB_HEALTH_CHECK_20260409.md`
|
||||
|
||||
- 대시보드 / 연도별 수익·비용 UI 개선
|
||||
- 대시보드 카드/그래프 구조 정리
|
||||
- 연도별 수익/비용 그래프 크기, 라벨, 축, 카드 활용도 개선
|
||||
- 페이지 공통 여백 구조 정리
|
||||
|
||||
## 주요 수정 파일
|
||||
|
||||
- `main.py`
|
||||
- `templates/projects.html`
|
||||
- `templates/annual_summary.html`
|
||||
- `templates/base.html`
|
||||
- `templates/dashboard.html`
|
||||
- `templates/index.html`
|
||||
- `data.db`
|
||||
|
||||
## 참고 데이터 파일
|
||||
|
||||
- `변경계약금액현황(회계)_총괄_20210101_20260409_260409.xlsx`
|
||||
- `변경계약금액현황(회계)_차수_20210101_20260409_260409.xlsx`
|
||||
|
||||
## 비고
|
||||
|
||||
- SQLite 기반 운영은 현재 데이터 규모에서는 가능하지만, 동시 작업과 화면 상태 저장은 계속 점검이 필요함
|
||||
- `data.db-wal`, `data.db-shm` 같은 런타임 임시 파일은 커밋 대상에서 제외함
|
||||
Reference in New Issue
Block a user