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

Add Bikes #43

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add Bikes #43

wants to merge 1 commit into from

Conversation

Strajk
Copy link

@Strajk Strajk commented Feb 27, 2023

As mentioned in the issue, this PR is not adding Zwift source files.

I wanted to avoid polluting dependencies and the main codebase with ugly XML parsing & processing, so I've put everything that handles it into the scripts/extract-data-from-app-source folder

Running scripts/extract-data-from-app-source/index.mjs will generate data/bikes.json.

data/bikes.json will then be processed by update-data as the other existing data (routes, segments, worlds), type-checked, and outputted to the src folder for publishing.


I'm not used to coding without ESLint so the formatting might not be consistent, feel free to share your config and I'll reformat it.

I'll DM you a quick video walk-through with some background info :)

Copy link
Owner

@andipaetzold andipaetzold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • we need to reexport bikes.ts from src/index.ts

make: string;
name: string;
year?: number;
level: number; // negative for special cases like Tron bike
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make the level optional instead of storing negative values?

@@ -234,6 +234,19 @@ export interface Segment {

export type SegmentType = "sprint" | "climb" | "segment";

export interface Bike {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do bikes have some kind of id we can use to identify them?

year?: number;
level: number; // negative for special cases like Tron bike
frameWeight: number;
frameCdA: number;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some frames have 0 or a negative number as CdA. Not an aero expert, but this looks more like the difference of the current frame compared to a "default bike". Maybe we can be more explicit in the name about this. A negative bike would probably ride itself :D

name: string;
year?: number;
level: number; // negative for special cases like Tron bike
frameWeight: number;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a jsdoc comment about the unit of the weights. It's obvious from the numbers but with the types it could be kg or gramms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants