internetarchive / internetarchive/openlibrary

Best Book Awards

Open
#9,520 3 comments 0 reactions 1 assignee Assigned to @noobCoderVP View on GitHub
Lead: @mekarpeles Priority: 2 Theme: Book Tags Theme: Reading Log Type: Feature Request
Dominant language
Python
Stars
6.7k
Forks
2k
Avg merge
2d 19h
Merged PRs (30d)
138

Description

### Feature: Best Books

https://docs.google.com/document/d/1Ddeg-fWWZ0iCFzVtZR0yGY_vCPttIUrd4tCIWwvYj6g/edit#heading=h.hwsgbba3g9bn

A feature called "Best Book Awards", where a patron who has `Already Read` a book may nominate it as the Best Book on a Topic.

### Requirements

* [x] Formalize the schema for Best Books
* [ ] Core Models for Best Book Nominations
* https://github.com/internetarchive/openlibrary/tree/master/openlibrary/core awards.py
* [ ] JSON API (similar for [ratings](https://github.com/internetarchive/openlibrary/blob/master/openlibrary/plugins/openlibrary/api.py#L119-L215)) for submitting, updating, and deleting nominations
* [ ] Adding 🏆 total counts to the Community Interest Bar
* [ ] Updating the Review Section to include 🏆 counts-per-topic
* [ ] Updating the `Already Read` Reading Log form to allow Best Book nominations
* [ ] Creating a form for submitting Best Book nominations

### Known Bugs

- [ ] Currently, as of Oct 8, 2024, if you submit an award w/o having marked the book as "Already Read", you see a toast error like: "You can award only if you have read the bookNonemekarpeles". (this has been on front-end but not on backend)

### Design Feedback

- [ ] The "Comments" section of the bestbook-modal should be larger / resizable (e.g. a textarea?)
- [ ]

### Next Steps
- [ ] Fix pre-commit errors
- [x] Make it so when you click the awards icon, it pulls up a new modal named `bestbook_modal_link` (because previously it was `observations_modal_link`)
- [x] Add js handlers to respond to `bestbook_modal_link` for modal toast messages
- [x] When we submit the form, we need some way to take the data and submit to the backend without refreshing the page → we’re using a click handler on the submit button + `fetch` POST
- [x] Add caution message if award is clicked but book is not yet marked as "already read"
- [x] CSS cleanup: Consolidate + decrease duplicated styles in our less using `&` nesting and cleaning up classes
- [ ] DRY & Update APIs: Get the awards and count together (**needs discussion**)
- [ ] Mobile responsiveness & review (**needs discussion**)

### Schema

table `best_book_nominations`:
* `id` serial
* `submitter`
* `work_id`
* `edition_id` (optional)
* `topic` (name or Tag key)
* `comment` (optional)
* `created`
* `updated`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.