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

mrc-4628 Filter out duplicate sessions from Sessions page #197

Merged
merged 12 commits into from
Oct 30, 2023
Merged

Conversation

EmmaLRussell
Copy link
Contributor

@EmmaLRussell EmmaLRussell commented Oct 24, 2023

This branch gives the user a checkbox to filter out duplicate sessions from the Sessions page (checked by default). Unlabelled sessions which are duplicates of a later session will not be shown. Labelled sessions are always shown (I think users would be confused if their labelled session vanished because a later session happened to be identical).

Now that we're saving hashes for sessions in order to identify duplicates, we could potentially make a further change to only save the data for a hash once, rather than for every session separately. One for another ticket: https://mrc-ide.myjetbrains.com/youtrack/issue/mrc-4677

@EmmaLRussell EmmaLRussell changed the title mrc-468 Filter out duplicate sessions from Sessions page mrc-4628 Filter out duplicate sessions from Sessions page Oct 25, 2023
@@ -283,9 +294,9 @@ export default defineComponent({
window.location.assign(link);
};

onMounted(() => {
onMounted(async () => {
await store.dispatch(AppStateAction.LoadUserPreferences);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to load user preferences now before fetching sessions metadata as we use the duplicates preference in query string parameter to the endpoint.


const saveMissingHashes = [];
// eslint-disable-next-line no-restricted-syntax
for await (const [idx, id] of ids.entries()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

eslint doesn't like plain old fors but this is preferable for including async in the loop

@EmmaLRussell EmmaLRussell marked this pull request as ready for review October 27, 2023 14:49
@codecov
Copy link

codecov bot commented Oct 27, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Files Coverage Δ
...tatic/src/app/components/sessions/SessionsPage.vue 100.00% <100.00%> (ø)
app/static/src/app/localStorageManager.ts 100.00% <ø> (ø)
app/static/src/app/store/appState/actions.ts 100.00% <100.00%> (ø)
app/static/src/app/store/appState/state.ts 100.00% <ø> (ø)
app/static/src/app/store/sessions/actions.ts 100.00% <100.00%> (ø)

📢 Thoughts on this report? Let us know!.

Copy link
Collaborator

@M-Kusumgar M-Kusumgar left a comment

Choose a reason for hiding this comment

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

nice just spent a bit of time going through this, quite like the implementation! so basically we will now store hashes of the data, compare them and return the most recent one, definitely way cleaner looking sessions page

@EmmaLRussell EmmaLRussell merged commit 994eb8b into main Oct 30, 2023
3 checks passed
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