openlab-at-city-tech / webworkqa

WeBWorK integration for WordPress and BuddyPress
GNU General Public License v2.0
4 stars 2 forks source link

Update to logic of "like" icon state #72

Closed boonebgorges closed 7 years ago

boonebgorges commented 7 years ago

See the following summary from Jenna:

likestates

moui72 commented 7 years ago

Boone, do you want any feedback on how things currently differ from this, or should we just ignore it until you're ready? (e.g., the "home page, results & logged out" case is currently a blue thumb where it should be either black or grey if no likes).

boonebgorges commented 7 years ago

No feedback necessary here - the specs in the attached image came from Jenna, but didn't make the Spring 2017 scope. We'll make the changes for the fall.

On 01/25/2017 01:58 PM, Tyler J. Peckenpaugh wrote:

Boone, do you want any feedback on how things currently differ from this, or should we just ignore it until you're ready? (e.g., the "home page, results & logged out" case is currently a blue thumb where it should be either black or grey if no likes).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/livinglab/webwork-for-wordpress/issues/72#issuecomment-275215966, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPDYzYBTJoISUvk35VS7_GeHhcQwFQiks5rV6lxgaJpZM4Lmapo.

moui72 commented 7 years ago

sounds good

boonebgorges commented 7 years ago

Implemented in dfc02a2. The logic here is very complex, so it needs careful testing. Here's the minimum amount of content you need to test everything:

Two items (questions or responses): Q1, Q2 Two users: A and B A has liked Q1, B has not No one has liked Q2

Then, check the following scenarios as A, B, and as a logged-out user:

  1. From home page/results page, all users should see the same thing, except that the logged-out visitor will get the tooltip when hovering over
  2. On single-problem page, all users should see Q1/Q2 according to their like statuses (see chart above)

Quick note about the visual: the fa-thumbs-up and fa-thumbs-o-up are not exactly the same shape, so moving back and forth between them causes a flicker. I didn't spend any time addressing this, since we may be moving away from the thumbs-up image anyway.

moui72 commented 7 years ago

I am avoiding this, for obvious reasons, but I will actually get into it on Saturday. And what a Saturday it will be!

moui72 commented 7 years ago

Sorry for the long delay, it's hard not to feel insane when looking at this.

Home page visuals are surface correct

From home page/results page, all users should see the same thing, except that the logged-out visitor will get the tooltip when hovering over. There is an issue with behavior, though (see below).

This seems to be true. To confirm, the hover states don't appear to work when logged in and looking at the overview/index, i.e. blue fa-thumbs-up never appears when "zoomed out."

Zoomed in seems good 👍

On single-problem page, all users should see Q1/Q2 according to their like statuses (see chart above)

This is working for the zoomed in view.

Home page/results page issue 😭

There are some issues with the zoomed out view. They all seem to center around the core issue of: I am able to like things from this view, despite the lack of hover visuals. Note that the thumb icon is always black fa-thumbs-up

Logging out and logging in resets the UI behavior

I can correctly like something only once during a session (but the icon is always black). If I log out and then log back in as a user that as already liked an item, the icon is black again and the UI will allow me to again like that item, which increments the like count visually. Page refresh will reset the count to before the redundant like, indicating that the database was not changed.

The correct number of likes will always be shown when "zoomed in"

Detailed sequences

boonebgorges commented 7 years ago

@moui72 Thank you very much for the thorough testing and description of the issue. The reason you were getting the weird log-in/log-out issue is that the voting mechanism was only partly disabled in the zoomed-out UI - as you guess, the database wasn't changed.

I believe I've fixed the issue of items being clickable when zoomed out.

moui72 commented 7 years ago

yes, it's all good now... ... ... except one very edgey edge case...

if I go from the index page (i.e. http://openlabdev.org/webwork-playground/) to a question view (e.g. http://openlabdev.org/webwork-playground/#:problemId=local/CoordinatePlaneTrig/six-trig-point-q1.pg:questionId=11457) and then like (or have already liked during previous session) and then use browser back to return to index, there will be 1 more like than is correct, but refresh fixes.

to be clear:

  1. Item 1 is liked by user A
  2. User A sees 1 like on index for item 1
  3. User A navigates to question view for item 1
  4. User A sees 1 like on question view for item 1
  5. User A uses browser back button to return to index
  6. User A sees 2 likes for item 1
  7. User A refreshes
  8. User A sees 1 like on index view for item 1
moui72 commented 7 years ago

also, just to say, I don't know if we need to bother fixing this right now. i just calls them like I sees them...

boonebgorges commented 7 years ago

Oof. It works this way because when you submit a like, the like count changes by incrementing/decrementing the count from the original pageload, not by returning an updated count from the browser. This can be changed, but it's not trivial because of the way the application currently differentiates between overall like counts and the like status of the logged-in user. Perhaps you could open a ticket against a future milestone that describes this?

moui72 commented 7 years ago

will do