From 9627b4ae174e80d7ac59fe4b5544988dbcfbb859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B8=94=EB=A6=AC=EC=96=B4?= Date: Sat, 21 Nov 2026 02:59:22 +0000 Subject: [PATCH] =?UTF-8?q?=EA=B7=BC=EB=AC=B4=20=EA=B5=90=ED=99=98=20?= =?UTF-8?q?=EB=8C=80=EA=B8=B0=20=EC=9A=94=EC=B2=AD=20=EC=9A=B0=EC=84=A0=20?= =?UTF-8?q?=ED=91=9C=EC=8B=9C=EC=99=80=20=EB=B3=80=EA=B2=BD=20=EA=B8=B0?= =?UTF-8?q?=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20=ED=95=9C=EB=8F=84=20=EB=B3=B4?= =?UTF-8?q?=EC=99=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 완료 요청이 쌓여도 대기 중인 요청을 먼저 보여 준다. 개인 변경 기록은 보관 한도와 같은 200건을 조회한다. 기록 205건과 완료 요청 101건 이후의 조회를 포함한 근무 관리 검사 8개를 통과했다. 기존 파일을 대조하고 별도 사본을 보관한 뒤 서버에 반영한다. --- server/test_work_management.py | 13 +++++++++++++ server/work_team.py | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/server/test_work_management.py b/server/test_work_management.py index 05934e9..59f4124 100644 --- a/server/test_work_management.py +++ b/server/test_work_management.py @@ -26,6 +26,19 @@ class WorkManagementTests(unittest.TestCase): target=self.client.get('/calendar/api/me',headers=self.auth(other)).json()['member']['id'] return other,target def request_swap(self,target):return self.team({'action':'request','target':target,'first':'2026-12-01','second':'2026-12-02'}) + def test_recent_history_and_pending_requests_remain_visible(self): + import work_team + other,target=self.prepare_pair();self.request_swap(target) + own=self.client.get('/calendar/api/me',headers=self.auth()).json()['member'] + with base.service.db() as conn: + for i in range(205):work_team.history(conn,own['calendarId'],'수정',str(i)) + row=conn.execute('SELECT * FROM work_swaps').fetchone() + for i in range(101): + conn.execute('INSERT INTO work_swaps VALUES(?,?,?,?,?,?,?,?,?,?,?,?)',(uuid.uuid4().hex,row['company'],row['requester'],row['target'],row['first_day'],row['second_day'],row['first_version'],row['second_version'],0,'completed',row['created']+i+1,row['updated'])) + history=self.client.get('/calendar/api/work/history',headers=self.auth()).json()['history'] + self.assertEqual(len(history),200);self.assertEqual(history[0]['title'],'204');self.assertEqual(history[-1]['title'],'5') + swaps=self.view().json()['swaps'];self.assertEqual(len(swaps),100);self.assertEqual(swaps[0]['status'],'pending') + def test_plan_history_override_and_old_client_preservation(self): plan={'changes':[{'from':'2026-12-01','anchor':'2026-12-01','pattern':['NIGHT','REST','REST'],'workWeek':5}], 'overrides':{'2026-12-05':{'shift':'LEAVE','note':'개인 사유'}}} self.assertEqual(self.rotation('2026-11-01',plan=plan).status_code,200) diff --git a/server/work_team.py b/server/work_team.py index 8ae9177..1b059aa 100644 --- a/server/work_team.py +++ b/server/work_team.py @@ -57,7 +57,7 @@ def setup(app,prefix,identity,payload,db,throttle,changed): @app.get(prefix+'/api/work/history') async def own_history(request:Request): actor=identity(request) - with db() as conn:return {'history':[dict(row) for row in conn.execute('SELECT action,title,created FROM work_history WHERE calendar=? ORDER BY id DESC LIMIT 100',(actor['calendar'],))]} + with db() as conn:return {'history':[dict(row) for row in conn.execute('SELECT action,title,created FROM work_history WHERE calendar=? ORDER BY id DESC LIMIT 200',(actor['calendar'],))]} @app.get(prefix+'/api/work/team') async def team(request:Request,on:str=''): @@ -67,9 +67,9 @@ def setup(app,prefix,identity,payload,db,throttle,changed): actor,group=member(conn,request) settings=conn.execute('SELECT approval FROM work_team_settings WHERE company=?',(group['id'],)).fetchone() # 개인 메모와 원본 일정은 전달하지 않는다. 교환 상태와 표시 이름만 공유한다. - swaps=[dict(row) for row in conn.execute('''SELECT s.id,s.requester,s.target,s.first_day,s.second_day,s.approval,s.status,s.created,s.updated,a.display_name requester_name,b.display_name target_name FROM work_swaps s JOIN members a ON a.id=s.requester JOIN members b ON b.id=s.target WHERE s.company=? ORDER BY s.created DESC,s.id LIMIT 100''',(group['id'],))] + swaps=[dict(row) for row in conn.execute('''SELECT s.id,s.requester,s.target,s.first_day,s.second_day,s.approval,s.status,s.created,s.updated,a.display_name requester_name,b.display_name target_name FROM work_swaps s JOIN members a ON a.id=s.requester JOIN members b ON b.id=s.target WHERE s.company=? ORDER BY CASE WHEN s.status IN ('pending','accepted') THEN 0 ELSE 1 END,s.created DESC,s.id LIMIT 100''',(group['id'],))] handover=conn.execute('SELECT author,version,data FROM work_handovers WHERE company=? AND day=?',(group['id'],on)).fetchone() - return {'company':company.shared_state(conn,actor['calendar']),'approval':bool(settings and settings[0]),'swaps':swaps,'handover':{'author':handover['author'],'version':handover['version'],'data':json.loads(handover['data'])} if handover else None,'history':[dict(row) for row in conn.execute('SELECT actor,action,created FROM work_team_history WHERE company=? ORDER BY id DESC LIMIT 100',(group['id'],))]} + return {'company':company.shared_state(conn,actor['calendar']),'approval':bool(settings and settings[0]),'swaps':swaps,'handover':{'author':handover['author'],'version':handover['version'],'data':json.loads(handover['data'])} if handover else None,'history':[dict(row) for row in conn.execute('SELECT actor,action,created FROM work_team_history WHERE company=? ORDER BY id DESC LIMIT 200',(group['id'],))]} @app.post(prefix+'/api/work/team') async def update(request:Request):