Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes #408

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
ecmaVersion: 2020,
sourceType: 'module',
},
extends: ['plugin:@typescript-eslint/recommended', 'prettier/@typescript-eslint', 'plugin:prettier/recommended'],
extends: ['plugin:@typescript-eslint/recommended', 'prettier', 'plugin:prettier/recommended'],
rules: {},
ignorePatterns: ['webpack.config.js', '**/*.d.ts'],
};
Binary file added __tests__/assets/replays/lc408finish.rec
Binary file not shown.
Binary file added __tests__/assets/replays/lc408one.rec
Binary file not shown.
4 changes: 4 additions & 0 deletions __tests__/rec.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ describe('Replay', () => {
['rec_valid_2.rec', 4],
['rec_valid_3.rec', 4],
['appbug.rec', 19],
['lc408one.rec', 1],
['lc408finish.rec', 5],
])('.apples counts correct number of apples: %s', async (fileName, apples) => {
const filePath = `__tests__/assets/replays/${fileName}`;
const file = await readFile(filePath);
Expand All @@ -228,6 +230,8 @@ describe('Replay', () => {
['rec_valid_2.rec', 4],
['rec_valid_3.rec', 4],
['appbug.rec', 36],
['lc408one.rec', 1],
['lc408finish.rec', 5],
])('.totalApples counts correct number of apples: %s', async (fileName, apples) => {
const filePath = `__tests__/assets/replays/${fileName}`;
const file = await readFile(filePath);
Expand Down
2 changes: 1 addition & 1 deletion src/rec/Replay.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Position, BufferInput } from '../shared';

Check warning on line 1 in src/rec/Replay.ts

View workflow job for this annotation

GitHub Actions / build (14)

'BufferInput' is defined but never used

Check warning on line 1 in src/rec/Replay.ts

View workflow job for this annotation

GitHub Actions / build (16)

'BufferInput' is defined but never used
import { nullpadString, trimString } from '../util';
import { Event, Frame, RideHeader, Ride } from './';

Check warning on line 3 in src/rec/Replay.ts

View workflow job for this annotation

GitHub Actions / build (14)

'Event' is defined but never used

Check warning on line 3 in src/rec/Replay.ts

View workflow job for this annotation

GitHub Actions / build (14)

'RideHeader' is defined but never used

Check warning on line 3 in src/rec/Replay.ts

View workflow job for this annotation

GitHub Actions / build (16)

'Event' is defined but never used

Check warning on line 3 in src/rec/Replay.ts

View workflow job for this annotation

GitHub Actions / build (16)

'RideHeader' is defined but never used
import { EventType } from './Event';

const EOR_MARKER = 0x00492f75; // replay marker
Expand Down Expand Up @@ -285,7 +285,7 @@
let apples = 0;

for (const ride of this.rides) {
const touchEvents = ride.events.filter((event) => event.type === 0);
const touchEvents = ride.events.filter((event) => event.type === 0).sort((a, b) => b.time - a.time);
const appleEvents = ride.events.filter((event) => event.type === 4);
const unique = [...new Set(touchEvents.map((event) => event.touchInfo))].map((event, idx) => touchEvents[idx]);

Expand Down
Loading