Repository: internetarchive/openlibrary

Issue:
Work subtitles should be shown in matching works in My Stats
My Stats page matching works doesn't show work subtitles, which can sometimes be important for distinguishing works

### Evidence / Screenshot (if possible)
![зображення](https://github.com/internetarchive/openlibrary/assets/58372007/542c2747-425a-4d7f-b899-9104cbf47ec7)

### Relevant url?
Author with such works https://openlibrary.org/authors/OL10602562A/Michael_Sisa

### Steps to Reproduce
<!-- What steps caused you to find the bug? -->
1. Go to ...
2. Do ...

<!-- What actually happened after these steps? What did you expect to happen? -->
* Actual:
* Expected:

### Details

- **Logged in (Y/N)?**
- **Browser type/version?**
- **Operating system?**
- **Environment (prod/dev/local)?** prod
<!-- If not sure, put prod -->

### Proposal & Constraints
<!-- What is the proposed solution / implementation? Is there a precedent of this approach succeeding elsewhere? -->

### Related files
<!-- Files related to this issue; this is super useful for new contributors who might want to help! If you're not sure, leave this blank; a maintainer will add them. -->

### Stakeholders
<!-- @ tag stakeholders of this bug -->



Discussion:
Can I work on this issue? Could you please assign this to me?
Go for it @siddoinghisjob !
@cdrini Can you please tell me how to reproduce the bug? The mentioned link has no such issue. It shows the sub-titles along with the titles. 
![image](https://github.com/internetarchive/openlibrary/assets/96379749/df107abb-64d2-49ab-a312-bcc3d1fc0515)

Hi @siddoinghisjob  ; you'll need to add some books (with sub titles) to your already read shelf, then go to your already read books and click the "reading stats" link. Then, click on one of the bar charts. You'll see a list of books at the bottom of the screen! URL should be something like https://openlibrary.org/account/books/already-read/stats
Sorry for asking again. I have been stuck at mybooks.py for a while now. In mybooks.py, I want to add 'subtitles' to the works_json's items so I can print them (book information) on the HTML view. But I can not find the attribute of subtitles anywhere. Can anyone please point me in the right direction in order to find the attribute of 'subtitle' so that I can add it to the works_json object? @cdrini 
Hi @siddoinghisjob ; the works json will already have the subtitle if one exists. See if you can find the file that renders that line of text. It might be in the html or the js. A common pattern for this is to in your browser, right click the line of text, and click "inspect element". Then see if there's a unique looking class name on/near the element. Then search the codebase for that class name. That should take you to the right file.

Resolving patch:
diff --git a/openlibrary/plugins/upstream/mybooks.py b/openlibrary/plugins/upstream/mybooks.py
--- a/openlibrary/plugins/upstream/mybooks.py
+++ b/openlibrary/plugins/upstream/mybooks.py
@@ -174,6 +174,7 @@ def GET(self, username, key='want-to-read'):
             {
                 # Fallback to key if it is a redirect
                 'title': w.get('title') or w.key,
+                'subtitle': w.get('subtitle'),
                 'key': w.get('key'),
                 'author_keys': ['/authors/' + key for key in w.get('author_key', [])],
                 'first_publish_year': w.get('first_publish_year') or None,


Test patch: