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

Intervals.icu not syncing workouts #246

Closed
semaj423 opened this issue Feb 7, 2025 · 9 comments
Closed

Intervals.icu not syncing workouts #246

semaj423 opened this issue Feb 7, 2025 · 9 comments

Comments

@semaj423
Copy link

semaj423 commented Feb 7, 2025

Not able to see intervals.icu workouts. I've tried disconnecting and reconnecting the sync and logging out and back on.

@dvmarinoff
Copy link
Owner

Thanks for the report!

So I checked the logs and I can see some errors with Intervals.icu for at least one account. It fails to parse the response from intervals. The odd thing is that it works with others including my accounts. Will look into it.

@semaj423
Copy link
Author

semaj423 commented Feb 7, 2025

Welcome and that one account is probably me. Thank you for Auuki and looking into this. :)

@dvmarinoff
Copy link
Owner

So this seems to be an issue with the format of the data being send from Intervals.icu.

  • Hypothesis One, There is some non-essential field missing in the data from Intervals

I did some changes that are more relaxed on the way the permitted Intervals.icu data, so if anything is missing the app will try to proceed. This case should be handled more gracefully from now on.

  • Hypothesis Two, There is something odd in the Planned Events List data that is being send, but shouldn't

Like do you have anything, but workouts on your Calender in Intervals.icu for the day?

Anyway let me know if it works for you with the latest changes!

@semaj423
Copy link
Author

semaj423 commented Feb 8, 2025

So this seems to be an issue with the format of the data being send from Intervals.icu.

  • Hypothesis One, There is some non-essential field missing in the data from Intervals

I did some changes that are more relaxed on the way the permitted Intervals.icu data, so if anything is missing the app will try to proceed. This case should be handled more gracefully from now on.

  • Hypothesis Two, There is something odd in the Planned Events List data that is being send, but shouldn't

Like do you have anything, but workouts on your Calender in Intervals.icu for the day?

Anyway let me know if it works for you with the latest changes!

Good points! Actually, I do have my gcal synced to intervals to show meetings I have throughout the day on intervals. And I noticed intervals planned workouts did flow through today as well.

@dvmarinoff
Copy link
Owner

Hey, did you had any success syncing workouts after the changes?

I am currently trying to figure out how to recreate the issue, but I can't seem to find how to add google calendar events to Intervals.icu.

@semaj423
Copy link
Author

semaj423 commented Feb 10, 2025 via email

@dvmarinoff
Copy link
Owner

OK managed to sync a google calendar to Intervals.icu, and indeed this is the issue. Google calendar events are being send along with workouts and are also marked as "workouts". So I added code that can handle this on my end, but will also let Interval.icu know.

Will leave here some technical notes:

Auuki is filtering for "WORKOUT" category in the request to the Intervals.icu API:

    let u = Url::parse_with_params(
        &format!("https://intervals.icu/api/v1/athlete/{intervals_athlete_id}/events"),
        &[
            ("oldest", params.oldest),
            ("newest", params.newest),
            ("category", "WORKOUT"),
            ("limit", "7"),
            ("ext", "zwo"),
        ]).map_err(|e| {
            tracing::error!("list events url parse {e}");
            Error::IntervalsUrlParseFail
        })?;

Then Deserializes the json body with EvenList and sends it to the front-end PWA:

#[derive(Debug, Deserialize, Serialize)]
pub struct Event {
    pub id: Option<i64>,
    pub start_date_local: Option<String>,
    pub category: Option<String>,
    pub name: Option<String>,
    pub indoor: Option<bool>,
    pub workout_filename: Option<String>,
    pub workout_file_base64: Option<String>,
}

type EventsList = Vec<Event>;

The PWA receives this:

Image

And here is what's in the Calendar for the day:

Image

@davidtinker
Copy link

It is possible to create Intervals.icu workouts via external calendars and workouts don't have to have steps so it is ok for Intervals.icu to be returning these. You should probably filter out workouts with null workout_doc or empty workout_doc.steps.

@dvmarinoff
Copy link
Owner

Yes, I see, so you can create and sync workouts from other calendars. I've updated the code to filter on the front-end too.
But just to note that events from other calendars are marked as a Workout by default, and they are not always workouts.

Image

Anyway it's resolved as for as Auuki is concerned so closing.

@semaj423 Thanks for the report and helping solve this one!

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

No branches or pull requests

3 participants