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

Fix the way that game descriptions are displayed #258

Closed
willcravitz opened this issue Nov 21, 2023 · 7 comments · Fixed by #288
Closed

Fix the way that game descriptions are displayed #258

willcravitz opened this issue Nov 21, 2023 · 7 comments · Fixed by #288
Assignees
Labels
bug Something isn't working x/game-management
Milestone

Comments

@willcravitz
Copy link
Contributor

willcravitz commented Nov 21, 2023

As of right now, game descriptions make the cards on the game browse page way too long. We need to display a shortened version of the description. There are also several XML special characters like 
 that we need to interpret correctly.

Image

@willcravitz willcravitz converted this from a draft issue Nov 21, 2023
@willcravitz
Copy link
Contributor Author

One way we could shorten the description is with the built in Django truncatewords and truncatechars template tags, described here.

@willcravitz willcravitz self-assigned this Nov 21, 2023
@willcravitz willcravitz added bug Something isn't working x/game-management labels Nov 21, 2023
@willcravitz willcravitz added this to the 2023/Sprint 3 milestone Nov 21, 2023
@willcravitz willcravitz moved this from Sprint Backlog to In Progress in CMSC 22000 Scrum Board Nov 24, 2023
@willcravitz
Copy link
Contributor Author

Created branch game-management/descriptions to address this issue.

@willcravitz
Copy link
Contributor Author

willcravitz commented Nov 24, 2023

I think I found a fix for the special XML characters that show up in descriptions. It requires manipulating the XML output from the BGG API call before we save them into the fixtures or use them for autofill. It will look something like this:

import xml.etree.ElementTree as ET
import xml.sax.saxutils

game_url = f"https://www.boardgamegeek.com/xmlapi2/thing?id={id}&stats=1"
game_response = requests.get(game_url)
text = xml.sax.saxutils.unescape(game_response.text)
game = ET.fromstring(text)

I've opened a new issue #283 to address this.

@willcravitz
Copy link
Contributor Author

willcravitz commented Nov 25, 2023

Because BGG descriptions are really long, on the game detail page I changed them from being a header beneath the title to text in the information section. I think it's still worth having a short description or tagline to go along with games, which BGG does have...
image
... for CATAN it's "Collect and trade resources to build up the island of Catan in this modern classic." Unfortunately this short description is not supported in the API. We could look into webscraping to get them.

With that I'm going to open a PR to merge these changes in.

@majorsylvie
Copy link
Contributor

One way we could shorten the description is with the built in Django truncatewords and truncatechars template tags, described here.

@willcravitz

FYI it is better for readability and accessibility to not add a hyperlink to one work.

Since there are folks who for whatever reason might not be able to distinguish the link color from the background / other characters. As well as the link being quite small (since here is only 4 letters).

Best practice for maximizing readability and making it easier to click and interact with is to add "here: https://docs.djangoproject.com/en/4.2/ref/templates/builtins/?from=olddocs#truncatechars "

I've had issues in my own job at CSIL where my boss has not been able to read someone documentation because they kept using these markdown hyperlinks.

Happy to explain more if you'd like!

@github-project-automation github-project-automation bot moved this from In Progress to Done in CMSC 22000 Scrum Board Nov 27, 2023
@willcravitz
Copy link
Contributor Author

Closing comments: This issue started with the observations that descriptions from BGG are far longer than our UI is built to support, and they have special XML characters. I opened issue #283 to address the XML characters. The outcome of this issue was to truncate descriptions on cards to 20 words and decrease the size of the descriptions on game detail pages. I've suggested adding a "short description" field from BGG that can fill the place of where the old description used to be.

@majorsylvie
Copy link
Contributor

Issue Score: Excellent

Comments:
Phenomenal work @willcravitz ! Your updates have been fantastic all quarter and this one is issue is no different.
Appreciate your use of images along with good description to capture the problem.

Thank you for you work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working x/game-management
Projects
Status: Done
2 participants