Skip to main content

Logbook Status Update - Adding "Not Current" Status

Overview

This update adds a new "not current" status to the logbook system to replace runtime calculations with stored status values, improving consistency and performance.

Change Request Summary

Add "not current" status to logbook entries to eliminate runtime parsing and create a single source of truth for currency status.

Total Time Estimate

?? hours (excluding testing and requirement clarification)

Current Status Types

Existing Statuses

  • closed: Pending approval
  • open: Approved
  • suspended: Approved but member has been suspended (change request)
  • disapproved: Instructor denied the request
  • manual: Manually assigned by instructor but requires member confirmation of training receipt

New Status

  • not current: Approved but currency isn't active (previously calculated at runtime)

Implementation Rationale

Benefits

  1. Consistency

    • Makes code easier to understand and maintain
    • Standardizes status handling across the system
  2. Performance Improvement

    • Removes runtime parsing overhead
    • Eliminates edge cases in status calculations
    • Ensures consistency with other status types
  3. Single Source of Truth

    • Centralized status management
    • Reduces data inconsistencies

Implementation Components

1. Currency Cron Updates (All Roles)

File: api/src/crons/currency

Changes:

  • Full Deactivate: Mark all role skills (Flyer, Instructor, etc.) as "Not Current"
  • Partial Deactivate: Mark deactivated level and above level skills as "Not Current"

2. Safety Training Service Updates

File: api/src/features/account/safety-training/service

Changes:

  • Function to get logbooks with particular category along with checkbox
  • Logic function for checkbox level to categories (e.g., first 3 checkboxes in instructor make instructor level 1 category "open")
  • Update status to "open"
  • Update below-level logbooks to "open" (if by mistake it was not updated)
  • For trainer, military, coach: all skills to "open" (currency completed in one shot)

3. Logbook Service Cleanup

File: api/src/features/account/logbook/service/index.js

Changes:

  • Remove "not current" logic and its functions (replaced by stored status)

4. Database Updates

Changes:

  • Update multiple queries for logbook to include "not current" status
  • Add status field validation for new status type

5. Testing Requirements

Testing Scope:

  • Verify status transitions work correctly
  • Test cron job functionality
  • Validate currency activation/deactivation
  • Ensure compatibility with existing suspend/unsuspend logic

Outstanding Questions

Status Transition Logic

  1. Suspended to Not Current: If logbook status is suspended and via cron it becomes "not current", when currency is applied, what status should be updated?

    • If suspended, need to create logic to store previous status of logbook
  2. Suspend/Unsuspend Impact: This change will affect suspend and unsuspend logic

    • Example: If skill is suspended and then becomes "not current", can it be suspended again?
    • Need to discuss handling of multiple status states

Dependencies

  • Clarification on suspended status handling
  • Suspend/unsuspend logic updates
  • Database schema modifications for new status type