Skip to Content

Currency System Changes - New Cycle Implementation

Overview

This document outlines the changes required to implement the new currency cycle system for the International Bodyflight Association platform.

Currency Cycle Structure

Cycle Periods

  • Cycle 1: January 16th to July 16th (6 months)
  • Cycle 2: July 16th to January 16th (6 months)

Notification Schedule

  • December 16th: Pre-cycle notification for Cycle 1
  • June 16th: Pre-cycle notification for Cycle 2

Business Requirements

Currency Validity Rules

  1. Standard Currency Period: When a member becomes uncurrent via cron job:

    • If they complete currency training within the first 5 months of a cycle → Valid for current cycle only
    • If they complete currency training in the last month of a cycle → Valid for both current and next cycle
  2. Grace Period Logic: Members who complete training in the final month receive extended validity to bridge cycles

Implementation Changes

1. Cron Job Module

File: api/src/features/shared/currency/service/index.js

Required Changes:

  • Function: getMemberIdsWithCurrency
    • Update main core query logic
    • Create new function to return last month timestamp
    • Identify users who completed currency in the last month
    • Mark other users as uncurrent
    • Reuse function logic for email notifications

Functions to Review:

  • updateLogbookNotCurrent - Verify no updates needed but check compatibility

Open Questions:

  • Q1: How does the existing “last currency active user” implementation (where users remain active but approval level updates to highest checkbox) integrate with new cycle logic?

2. Safety Currency Log Module

File: api/src/features/shared/currency/service/instructor.service.js

Required Changes:

  • Function: getCurrencyMembers
    • Return users when safety training is:
      • Not completed, OR
      • Completed within the last 5 months

Open Questions:

  • Q2: If a user completes currency in month 3, they won’t appear in the list for the next 2 months. Should they reappear in the last month to take advantage of the next cycle benefit?

3. Instructor Currency Checkboxes

File: api/src/features/account/safety-training/service/instructor.service.js

Required Changes:

  • Function: getInstructorCurrencyCheckboxes
    • Display checkboxes based on current month within cycle
    • Show appropriate checkbox set (new cycle vs. current cycle)

Open Questions:

  • Q3: For a full instructor (Level 4) who completes up to Level 3 in the first 5 months, then starts the last month:
    • Should they complete the ongoing Level 3 first, then start new cycle?
    • Or start fresh with new cycle checkboxes?

4. Save Instructor Member Logic

File: api/src/features/account/safety-training/service/instructor.service.js

Required Changes:

  • Function: saveInstructorMember
    • Update approval level assignment logic
    • Handle dual-cycle validity scenarios

Open Questions:

  • Q4: Scenario handling for approval level conflicts:
    • User completes full Instructor Level 4 (approval level 7) in first 5 months
    • Then completes only Level 2 (approval level 3) in last month
    • Should approval level be updated when assigning new currency?
    • Impact on logbook access (not_current status affects logbook opening)

5. Member Upgrade Logic

Required Changes:

  • When users complete a full level and receive new logbooks in the last month:
    • Option A: Add new level checkbox to previous currency record
    • Option B: Create new currency record with all previous checkboxes plus new level

6. Profile User Endpoint

File: api/src/features/shared/member/service/index.js

Required Changes:

  • Function: currencyInstructorData
    • Update renewal currency date calculation logic
    • Account for dual-cycle validity periods

Technical Considerations

Database Schema Impact

  • Currency records may need additional fields to track:
    • Cycle validity periods
    • Last month completion flags
    • Dual-cycle validity indicators

Email Notification System

  • Update notification logic to use new timestamp functions
  • Ensure proper cycle transition messaging

Logbook Access Control

  • Verify approval level changes don’t inadvertently affect logbook access
  • Maintain consistency between currency status and logbook permissions

Testing Requirements

Test Scenarios

  1. Standard 5-month completion: Verify single-cycle validity
  2. Last month completion: Verify dual-cycle validity
  3. Mid-cycle member upgrade: Test checkbox assignment logic
  4. Approval level conflicts: Ensure proper level assignment
  5. Email notifications: Verify correct timing and content
  6. Logbook access: Confirm no unintended restrictions

Migration Plan

  1. Phase 1: Update core currency validation logic
  2. Phase 2: Modify instructor service functions
  3. Phase 3: Update profile and member upgrade logic
  4. Phase 4: Test email notification system
  5. Phase 5: Deploy with comprehensive monitoring

Risk Assessment

High Risk Areas

  • Approval level calculation changes affecting existing members
  • Logbook access modifications
  • Email notification timing changes

Mitigation Strategies

  • Comprehensive unit testing for all modified functions
  • Staged deployment with rollback capability
  • Member communication about system changes
  • Monitoring for unexpected currency status changes

This document should be updated as implementation progresses and open questions are resolved.

Last updated on