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

1595/instance filtering #1610

Closed

Conversation

chrissolanilla
Copy link

@chrissolanilla chrissolanilla commented Sep 27, 2024

In this pull request I have added 3 buttons underneath the My Widget Page in Materia for more advanced filtering.

Changes

I ended up changing the styles of the sidebar to be more flexible(no pun intended) so it makes more sense and so that it can comply with my button additions.

For the actual filters I made them check boxes with a parent of a clickable div. They change color when clicked or when you press the keyboard when they are focused. When they are focused I gave them a nice blue highlight to the parent div similar to how I did it in connections.

The three filters I added are Drafts:On/Off , Published:On/Off and Has Score:On/Off
These filters will filter based on the properties of the instance object for instance with properties of draft for both buttons Drafts: On/Off and Published: On/Off. For the filter Has Score:On/Off, I made an api call to get the scores instead of looking at the properties of the instance since the attempts property seems to always be -1.

Copy link
Member

@clpetersonucf clpetersonucf left a comment

Choose a reason for hiding this comment

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

A few high-level comments:

  • You have commits from the unrelated 1600/save draft button #1602 PR on this branch/PR
  • The loading throbber and associated visual changes when widget instances are being requested are broken. These elements would overlay the search bar until instance loading is complete.
  • The filter buttons don't really work in their current position below the search bar. I would rather the filter options remain hidden within an element that expands within the sidebar when toggled. I can work with you to figure out how that might look.
  • Draft and Published filter options are good. attempts has nothing to do with whether an instance possesses scores; it's the setting associated with an instance's attempt limit. It's set via the settings dialog in My Widgets (under Collaborate/Copy/Delete). That said, filtering by instances that possess an attempt limit is a good add.
  • Similarly, filtering by instances with open/close dates would be ideal.

I appreciate the effort you made in getting score information for each instance, but there are some significant issues with your approach:

  • Memoizing the instance score information is good, but please conform to our use of react query to facilitate API requests in the future
  • I am very much not a fan of requesting apiScoreSummaryGet for each instance that's received. Users can potentially have hundreds of instances, which results in hundreds of requests to the server happening all at once. Instead, I think we should consider appending some minimal score information to widget instance objects themselves on the server as part of the response to widget_paginate_user_instances_get. The least impactful version is probably a score count (via COUNT from log_play associated with an inst_id) but I'd also prefer that value isn't even included unless the API request specifically asks for it (via another parameter in the widget_paginate_instances_get call). This would mean potential changes to the api_v1, widget_instance_manager, and widget_instance classes.

@clpetersonucf
Copy link
Member

Closing, replaced with #1614

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