Skip to content

Commit f918445

Browse files
Merge pull request #10 from ironprogrammer/update-progression-validation
2 parents f7c51aa + 14af686 commit f918445

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

.github/scripts/update-readme-inconsistencies.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ function updateReadme(readmePath, issues) {
154154

155155
// Extract the part after the section header and before the table
156156
// This includes the intro text
157-
const beforeTable = 'The following issues were observed in the source data from the OSI site, and are highlighted in the app:\n\n';
157+
const beforeTable = 'The following issues were observed in the source data from the OSI site\\*, and are highlighted in the app:\n\n';
158158

159159
// Generate new table
160160
const newTable = generateTable(issues);

.github/scripts/validate-time-progression.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,17 @@ function validateProgression(timeA, timeBPlus, timeB) {
171171
const expectedBStr = secondsToTimeString(expectedB);
172172

173173
// Allow tiny floating point tolerance (0.005 seconds = 0.5 centiseconds)
174-
if (Math.abs(secB - expectedB) > 0.005) {
174+
const bIsIncorrect = Math.abs(secB - expectedB) > 0.005;
175+
if (bIsIncorrect) {
175176
invalidStandards.push('B');
176177
issues.push(`B should be ${expectedBStr} (A × 1.1, rounded to 1 decimal + 0.09)`);
177178
}
178179

179-
// Calculate expected B+ from A and B
180-
const expectedBPlus = calculateExpectedBPlus(secA, secB);
180+
// Calculate expected B+ from A and corrected B (not the actual B from PDF)
181+
// This way, if B is wrong but B+ is correct relative to what B should be,
182+
// we won't flag B+ as an error
183+
const bTimeForBPlusCalculation = bIsIncorrect ? expectedB : secB;
184+
const expectedBPlus = calculateExpectedBPlus(secA, bTimeForBPlusCalculation);
181185
const expectedBPlusStr = secondsToTimeString(expectedBPlus);
182186

183187
if (Math.abs(secBPlus - expectedBPlus) > 0.005) {

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The following issues were observed in the source data from the OSI site\*, and a
2525

2626
### Issue Key
2727
- **Invalid format**: The time does not match the pattern `MM:SS.MS` or `SS.MS`, or exceed 60-second increment notation (e.g. `96.99` seconds).
28-
- **Invalid progression**: The time does not fit in the expected "faster to slower" time progression for standards: `A < B+ < B`.
28+
- **Invalid progression**: The time does not fit in the expected "faster to slower" time progression calculation for standards: `A < B+ < B`.
2929

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

0 commit comments

Comments
 (0)