Skip to content

Commit f1d4280

Browse files
Merge pull request #2 from ironprogrammer/dont-correct-data
Tested locally and LGTM.
2 parents 6eb289f + 7e4ae15 commit f1d4280

File tree

3 files changed

+36
-17
lines changed

3 files changed

+36
-17
lines changed

README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,17 @@ Please consider helping me cover my kid's swim meet fees!
88

99
<a href="https://www.buymeacoffee.com/ironprogrammer" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
1010

11-
## Data Corrections - 2024-2025 Time Standards
11+
## Data Inconsistencies ⚠️
1212

13-
The following guesstimated "corrections" were applied to clearly inconsistent data\* in the source PDF from the OSI site:
13+
The following issues were observed in the source data from the OSI site, and are highlighted in the app:
1414

15-
| Age/Gender | Event | Course | Standard | PDF Value | JSON Value | Status | Reason |
16-
|------------|-------|--------|----------|-----------|------------|--------|--------|
17-
| Girls 9 | 100 Breast | LCM | A | `1:96.99` | `1:56.99` | ✅ Corrected | Invalid format |
18-
| Girls 10 | 100 Fly | LCM | B+ | `125:79.19` | `1:54.19` | ✅ Corrected | Possible OCR error |
19-
| Girls 13 | 200 Breast | SCM | B | `2:51.89`** | `2:51.89` | ⚠️ Error | B faster than A/B+ |
15+
| Age/Gender | Event | Course | Standard | Value | Issue |
16+
| ---------- | ---------- | ------ | -------- | ----------- | ------------------- |
17+
| Girls 9 | 100 Breast | LCM | A | `1:96.99` | Invalid format |
18+
| Girls 10 | 100 Fly | LCM | B+ | `125:79.19` | Invalid format |
19+
| Girls 13 | 200 Breast | SCM | B | `2:51.89` | Invalid progression |
2020

21-
\* *The OSI PDF may contain errors; and so can this app! Refer directly OSI for questions/corrections.*
22-
23-
\** *Value not updated in JSON, however `3:31.89` might be the expected value based on time progression for this event.*
21+
\* *The OSI PDF may contain errors, and so can this app! Refer directly to OSI for questions/corrections.*
2422

2523
> 🪲 Encounter any other issues? Head over to the [Issues tab](https://github.com/ironprogrammer/swimcheck/issues) and let me know!
2624

index.html

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@
100100
transition: background-color 0.3s ease;
101101
}
102102

103+
/* Row with invalid standard gets light yellow background on all cells */
104+
.event-table tr.has-invalid-standard td {
105+
background-color: #fff9e6;
106+
transition: background-color 0.3s ease;
107+
}
108+
103109
/* Standard cells */
104110
.standard-cell {
105111
font-family: 'Courier New', monospace;
@@ -483,6 +489,12 @@ <h1>Swim Check 🏊</h1>
483489
// Add 'has-value' class to row if user has entered a time
484490
// Add met class to row for input border styling
485491
let rowClass = userTime ? 'has-value' : '';
492+
493+
// Add 'has-invalid-standard' class if any standard has warning emoji
494+
if (hasInvalidStandard(times)) {
495+
rowClass += ' has-invalid-standard';
496+
}
497+
486498
if (qualification === 'a') {
487499
rowClass += ' met-a';
488500
} else if (qualification === 'b-plus') {
@@ -636,9 +648,10 @@ <h1>Swim Check 🏊</h1>
636648
const userSeconds = timeToSeconds(userTime);
637649
if (userSeconds === null) return null;
638650

639-
const aTime = standards.A ? timeToSeconds(standards.A) : null;
640-
const bPlusTime = standards['B+'] ? timeToSeconds(standards['B+']) : null;
641-
const bTime = standards.B ? timeToSeconds(standards.B) : null;
651+
// Skip standards with warning emoji (invalid data)
652+
const aTime = (standards.A && !standards.A.includes('⚠️')) ? timeToSeconds(standards.A) : null;
653+
const bPlusTime = (standards['B+'] && !standards['B+'].includes('⚠️')) ? timeToSeconds(standards['B+']) : null;
654+
const bTime = (standards.B && !standards.B.includes('⚠️')) ? timeToSeconds(standards.B) : null;
642655

643656
// Lower times are better in swimming
644657
if (aTime !== null && userSeconds <= aTime) {
@@ -652,11 +665,19 @@ <h1>Swim Check 🏊</h1>
652665
}
653666
}
654667

668+
// Check if any standard has invalid data (contains warning emoji)
669+
function hasInvalidStandard(times) {
670+
return (times.A && times.A.includes('⚠️')) ||
671+
(times['B+'] && times['B+'].includes('⚠️')) ||
672+
(times.B && times.B.includes('⚠️'));
673+
}
674+
655675
// Convert time string to seconds
656676
function timeToSeconds(timeStr) {
657677
if (!timeStr) return null;
658678

659-
timeStr = timeStr.trim();
679+
// Strip non-time characters (only allow numerics, ':', and '.')
680+
timeStr = timeStr.trim().replace(/[^0-9:.]/g, '');
660681

661682
// Format: MM:SS.MS or SS.MS
662683
const parts = timeStr.split(':');

swim_time_standards.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
"name": "100 Breast",
206206
"SCY": { "A": "1:43.99", "B+": "1:49.19", "B": "1:54.39" },
207207
"SCM": { "A": "1:54.39", "B+": "2:00.19", "B": "2:05.89" },
208-
"LCM": { "A": "1:56.99", "B+": "2:02.79", "B": "2:08.59" }
208+
"LCM": { "A": "1:96.99⚠️", "B+": "2:02.79", "B": "2:08.59" }
209209
},
210210
{
211211
"name": "50 Fly",
@@ -362,7 +362,7 @@
362362
"name": "100 Fly",
363363
"SCY": { "A": "1:29.39", "B+": "1:33.89", "B": "1:38.39" },
364364
"SCM": { "A": "1:38.39", "B+": "1:43.39", "B": "1:48.29" },
365-
"LCM": { "A": "1:48.49", "B+": "1:54.19", "B": "1:59.39" }
365+
"LCM": { "A": "1:48.49", "B+": "125:79.19⚠️", "B": "1:59.39" }
366366
},
367367
{
368368
"name": "100 IM",
@@ -1160,7 +1160,7 @@
11601160
{
11611161
"name": "200 Breast",
11621162
"SCY": { "A": "2:54.69", "B+": "3:03.39", "B": "3:12.59" },
1163-
"SCM": { "A": "3:12.19", "B+": "3:21.79", "B": "2:51.89" },
1163+
"SCM": { "A": "3:12.19", "B+": "3:21.79", "B": "2:51.89⚠️" },
11641164
"LCM": { "A": "3:11.89", "B+": "3:21.39", "B": "3:31.49" }
11651165
},
11661166
{

0 commit comments

Comments
 (0)