Skip to content

Birth Year Truncation in .CSV exportΒ #105

@dradspinner

Description

@dradspinner

Bug: CSV Export Truncates Birth Years (1986 β†’ 86)

πŸ› Summary

CSV export truncates 4-digit birth years to 2-digit using modulo 100 operation, causing data loss and century ambiguity.

Example: Runner born in 1986 exports as "86" in CSV

πŸ” Bug Location

File: code/oImportExport.cpp
Line: 176

πŸ“ Current Code (Broken)

row[OEbirth] = conv_is(di.getInt("BirthYear") % 100);

βœ… Proposed Fix

row[OEbirth] = conv_is(di.getInt("BirthYear"));

Change: Simply remove the % 100 modulo operation.

πŸ§ͺ Test Case

  1. Create runner with birth year 1986
  2. Export to CSV
  3. Current Result: CSV shows 86
  4. Expected Result: CSV shows 1986

πŸ’₯ Impact

  • Data Loss: Century information is permanently lost in CSV exports
  • Ambiguity: Cannot distinguish between 1986 and 2086 (both become "86")
  • Import Problems: Other systems receiving the CSV cannot reliably determine actual birth years
  • Age Calculations: Incorrect age calculations due to missing century

πŸ“Š Real-World Examples

  • Runner born 1975 β†’ exports as 75 (could be 1975 or 2075)
  • Runner born 2008 β†’ exports as 8 (could be 1908, 2008, or 2108)
  • Runner born 1999 β†’ exports as 99 (could be 1899, 1999, or 2099)

🎯 Why This Fix is Safe

  • Backward Compatible: Systems expecting 4-digit years will work correctly
  • Forward Compatible: Future years beyond 2099 will export properly
  • Data Preservation: No information is lost
  • One Line Change: Minimal risk of introducing new bugs

⚑ Priority: HIGH

This is a simple one-line fix that resolves significant data loss. The fix is:

  • βœ… Easy to implement
  • βœ… Low risk
  • βœ… High impact
  • βœ… Affects all CSV exports

πŸ“ Files to Change

  • code/oImportExport.cpp (Line 176 only)

Bug discovered through practical orienteering event management and confirmed via source code analysis.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions