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

Activity title changes not updated #116

Open
MrSpock77 opened this issue May 10, 2022 · 6 comments
Open

Activity title changes not updated #116

MrSpock77 opened this issue May 10, 2022 · 6 comments
Assignees
Labels

Comments

@MrSpock77
Copy link

When an athlete changes the title of an activity after it has been imported, Sauce still shows the original title. I have tried to reimport the activity, but the title remains unchanged. Is it be possible to update the title in the database every time an activity is opened in the browser? Otherwise, let the reimport feature update the title.

@mayfield
Copy link
Collaborator

I actually do have code for this that should be updating type, name and description when you visit the analysis page for an activity. Just to double check, you're visiting the /activities/<id> page for the activity in question (waiting at least 2 seconds too) and then when going back to Sauce Performance it's still the old meta data?

@mayfield
Copy link
Collaborator

sauce.sleep(2000).then(async () => {
const fullAct = await fetchFullActivity();
if (!fullAct) {
return;
}
const updates = {};
for (const x of ['type', 'name', 'description']) {
if (fullAct.get(x) !== ret.syncActivity[x]) {
updates[x] = fullAct.get(x);
}
}
if (updates.type) {
const basetype = sauce.model.getActivityBaseType(updates.type);
if (basetype && basetype !== ret.syncActivity.basetype) {
await sauce.report.event('SyncActivity', 'type-change',
`${ret.syncActivity.basetype} -> ${basetype}`);
updates.basetype = basetype;
}
}
if (Object.keys(updates).length) {
await sauce.hist.updateActivity(activity.id, updates);
Object.assign(ret.syncActivity, updates);
if (updates.basetype) {
await sauce.hist.deletePeaksForActivity(activity.id);
await sauce.hist.invalidateActivitySyncState(activity.id, 'local', null,
{wait: true});
setSyncDone();
}
await sauce.report.event('SyncActivity', 'update', Object.keys(updates).join());
}
});

@MrSpock77
Copy link
Author

Yes, i am visiting /activities/<id>, but the Activities Table is not updated.

Browser: Firefox 100.0
Sauce: 8.0.8

@mayfield
Copy link
Collaborator

Must be a regression then. I'll have a look.

Thank you.

@mayfield mayfield self-assigned this May 10, 2022
@mayfield mayfield added the bug label May 10, 2022
@mayfield
Copy link
Collaborator

@MrSpock77 one more question. If you restart FireFox is the meta data updated? I have a pretty complicated database caching system and if the restart affects this, then I've got a bug there.

@MrSpock77
Copy link
Author

No

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

No branches or pull requests

2 participants