Skip to content

Instantly share code, notes, and snippets.

@GunnerCat
Last active August 22, 2025 07:27
Show Gist options
  • Select an option

  • Save GunnerCat/26f56e14abe503c213b451f0c8ed10bb to your computer and use it in GitHub Desktop.

Select an option

Save GunnerCat/26f56e14abe503c213b451f0c8ed10bb to your computer and use it in GitHub Desktop.
Planning Allow Minus full AI.md

Judul : [BE] - [71239] - [Enhancement - Penambahan data Allow Minus pada Attendance Code]

Backlog : Link Backlog

Planning Generated by AI : Link hasil generate AI

Of course. Here is the refactored project plan based on your requirements, incorporating necessary details from the provided documents.

Planning [8 hours]

  • [4h] Analyze and understand the existing codebase related to leave balance calculation and transaction processing.
  • [4h] Review the product backlog requirements, focusing on the "Allow Minus" feature and its impact on existing customers.

Development [32 hours]

  • Database Enhancement & Migration
    • [4h] Create new columns (AllowMinus, AllowMinusLimit) in the AttendanceCode table and apply the database migration. 2
    • [4h] Create and execute a script to set default values (Allow Minus = 'No', Limit = Empty) for all existing AttendanceCode records of type 'Annual Leave'. 3
  • Refactor getActiveLeaveBalanceByEmployeeId Logic
    • [4h] Investigate and map the current implementation of getActiveLeaveBalanceByEmployeeId to understand its assumptions and data flow.
    • [4h] Develop the changes to handle cases where an employee has a negative leave balance ("debt").
  • Implement Leave Debt Payment Logic
    • [4h] Design and scaffold the service method that triggers when a new leave balance is allocated to an employee.
    • [4h] Implement the logic to detect if an employee has an existing leave debt (identified by a null MasterLeaveId) and calculate the result of the new allocation.
    • [4h] Implement the specific logic for when a new leave allocation partially pays off an existing debt (the new balance is less than the debt amount).
    • [4h] Implement the logic for when a new leave allocation fully clears a debt and results in a new positive leave balance (the new balance is greater than the debt amount).

UnitTest [16 hours]

  • Create new test cases for leave debt scenarios
    • [4h] Set up test data and cover new scenarios in getActiveLeaveBalanceByEmployeeId where the balance can be negative.
    • [4h] Write unit tests for the partial debt payment scenario, ensuring the debt record is correctly updated.
    • [4h] Write unit tests for the full debt payment scenario, ensuring the debt is cleared and no surplus is created.
    • [4h] Write unit tests for the debt payment with surplus scenario, ensuring the debt is cleared and a new positive balance record is correctly created with the remainder.

Acceptance Criteria (QA & Testing) [8 hours]

  • Verify that users can request leave with an insufficient balance up to the configured limit.
    • [4h] Perform end-to-end testing via the user interface on Andal Connect (Request Leave) and Andal Kharisma (Create Transaction on Roster). 5
    • [4h] Perform end-to-end testing using the Import Transaction Leave feature on the Roster, with import files containing cases that test the new limit rules. 6
@jeje-andal
Copy link

@GunnerCat

  1. Bagian ini bisa dijelasin singkat summary nya kah?
    Implement Leave Debt Payment Logic
    • tolong konfirmasi betul begini atau ga ya
      • Akan dianggap debt jika MasterLeaveId null
      • Saat emerge, akan dicari apakah ada data Request leave dengan MasterLeaveId null, jika ada akan diisi
  2. Poin planning AI ini blm dimasukin, tapi udh aware kan ya kalau ini perlu dilakukan juga?
    • API/GraphQL
      • Task 4: Modify the Add/Edit AttendanceCode API endpoint to accept and persist the new AllowMinus and AllowMinusLimit fields. (Ref: )
      • Task 5: Ensure the Get AttendanceCode API endpoint returns the values of the new AllowMinus and AllowMinusLimit fields. (Ref: )
  3. Ini semua pakai endpoint yg sama ya? cukup ubah di 1 tempat saja?
    • Task 7: Refactor the 'Create Transaction Leave' feature in the Roster to use the new LeaveBalanceValidationService for its validation checks. (Ref: )
    • Task 8: Refactor the 'Request Leave' feature in Andal Connect to use the new LeaveBalanceValidationService. (Ref: , )
    • Task 9: Refactor the 'Import Transaction Leave' logic to use the new LeaveBalanceValidationService during the import validation process (Checking Number 6). (Ref: , )
  4. Ini sepertinya perlu ditambahkan, kalau blm ada
    • Testing
      • Task 11: Write comprehensive unit tests for the LeaveBalanceValidationService, covering all scenarios: 'Yes', 'No', 'First Year', limited, unlimited, and edge cases for employee join dates. (Ref: )
      • Task 12: Create integration tests for the Add/Edit AttendanceCode API endpoint to ensure the new fields are saved and retrieved correctly.
  5. Method get leave ballance yg skrg udh ada unit test nya blm ya?
    • Kalau blm, mungkin sebelum ada changes sama sekali di allow minus ini, bisa minta AI lengkapin unit test nya dulu
    • Jadi nanti abis ada yg allow minus bisa cross check ke case yg sebelumnya
    • Perlu dilihat dan konfirmasi lagi, apakah oke untuk di implement

@GunnerCat
Copy link
Author

tolong konfirmasi betul begini atau ga ya
Akan dianggap debt jika MasterLeaveId null
Saat emerge, akan dicari apakah ada data Request leave dengan MasterLeaveId null, jika ada akan diisi

sbnrnya yang ini udah ada discussion baru lagi, karena ada permasalahan masterLeaveId, jadinya final decission yang di kasih dari lead SC, adalah apus aja masterLeaveId, jadi leaveBalance yang used, tidak akan memiliki masterLeaveId, utang maupun tidak

Poin planning AI ini blm dimasukin, tapi udh aware kan ya kalau ini perlu dilakukan juga?
API/GraphQL
Task 4: Modify the Add/Edit AttendanceCode API endpoint to accept and persist the new AllowMinus and AllowMinusLimit fields. (Ref: )
Task 5: Ensure the Get AttendanceCode API endpoint returns the values of the new AllowMinus and AllowMinusLimit fields. (Ref: )

attendance code yang berhubungan dengan annualLeave tidak bisa di add, dan untuk edit nya, yang disesuaikan hanya mutation nya saja, yaitu ditambahkan allowMinus dan limit

Task 7: Refactor the 'Create Transaction Leave' feature in the Roster to use the new LeaveBalanceValidationService for its validation checks. (Ref: )
Task 8: Refactor the 'Request Leave' feature in Andal Connect to use the new LeaveBalanceValidationService. (Ref: , )
Task 9: Refactor the 'Import Transaction Leave' logic to use the new LeaveBalanceValidationService during the import validation process (Checking Number 6). (Ref: , )

dari aku nggak ada yang dirubah, mostly yang dirubah di value yang di return pada saat query getActiveLeaveBalance, supaya FE tau user punya debt berapa, dari situ bisa dipake di semua validation

Ini sepertinya perlu ditambahkan, kalau blm ada
Testing
Task 11: Write comprehensive unit tests for the LeaveBalanceValidationService, covering all scenarios: 'Yes', 'No', 'First Year', limited, unlimited, and edge cases for employee join dates. (Ref: )
Task 12: Create integration tests for the Add/Edit AttendanceCode API endpoint to ensure the new fields are saved and retrieved correctly.

kita nggak ada "LeaveBalanceValidationService"

Method get leave ballance yg skrg udh ada unit test nya blm ya?
Kalau blm, mungkin sebelum ada changes sama sekali di allow minus ini, bisa minta AI lengkapin unit test nya dulu
Jadi nanti abis ada yg allow minus bisa cross check ke case yg sebelumnya
Perlu dilihat dan konfirmasi lagi, apakah oke untuk di implement

unit test untuk returning debt pada getActiveLeaveBalance sudah dibuat

@jeje-andal
Copy link

@GunnerCat
sbnrnya yang ini udah ada discussion baru lagi, karena ada permasalahan masterLeaveId, jadinya final decission yang di kasih dari lead SC, adalah apus aja masterLeaveId, jadi leaveBalance yang used, tidak akan memiliki masterLeaveId, utang maupun tidak

oh gitu, berarti sekarang hitungnya murni jumlah balance - jumlah request ya Piet?

kita nggak ada "LeaveBalanceValidationService"

iya gpp, maksudnya pengecekan yg ini ga begitu relate di BE ya? karena ini ceknya di FE?
'Yes', 'No', 'First Year', limited, unlimited, and edge cases for employee join dates

@GunnerCat
Copy link
Author

betul kak, jadi pure dari perhitungan jumlah balance dan used nya

@GunnerCat
Copy link
Author

betul, untuk penggunaan Yes No dan First Year itu semua nya di cek di front end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment