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

Re-enabled autofill on add new book form #8688

Merged
merged 5 commits into from
Jan 8, 2024

Conversation

btwshivam
Copy link
Contributor

Closes #8598

Technical

updated book_title as the new name
Added book_title="" as object to post handler and set the value of i.title to i.book_title

Testing

Screenshot

Stakeholders

Copy link
Collaborator

@jimchamp jimchamp left a comment

Choose a reason for hiding this comment

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

Thanks, @shivam200446.
Instead of changing i.title to i.book_title throughout the code, please set i.title = i.book_title like I asked. You can do this on line 229, right after i is defined.

@@ -311,7 +312,7 @@ def find_matches(
return edition or work # Case 3 or 2, from check page

edition = self.try_edition_match(
title=i.title,
title=i.book_title,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
title=i.book_title,
title=i.title,

@@ -325,7 +326,7 @@ def find_matches(
solr = get_solr()
# Less exact solr search than try_edition_match(), search by supplied title and author only.
result = solr.select(
{'title': i.title, 'author_key': author_key.split("/")[-1]},
{'title': i.book_title, 'author_key': author_key.split("/")[-1]},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
{'title': i.book_title, 'author_key': author_key.split("/")[-1]},
{'title': i.title, 'author_key': author_key.split("/")[-1]},

@@ -458,7 +459,7 @@ def no_match(self, saveutil: DocSaveHelper, i: web.utils.Storage) -> NoReturn:
"""
# Any new author has been created and added to
# saveutil, and author_key added to i
work = new_doc("/type/work", title=i.title, authors=i.authors)
work = new_doc("/type/work", title=i.book_title, authors=i.authors)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
work = new_doc("/type/work", title=i.book_title, authors=i.authors)
work = new_doc("/type/work", title=i.title, authors=i.authors)

openlibrary/plugins/upstream/addbook.py Outdated Show resolved Hide resolved
@jimchamp jimchamp added the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Jan 5, 2024
@jimchamp jimchamp self-assigned this Jan 5, 2024
@btwshivam
Copy link
Contributor Author

Thanks, @shivam200446. Instead of changing i.title to i.book_title throughout the code, please set i.title = i.book_title like I asked. You can do this on line 229, right after i is defined.

Sorry for inconvenience!

@jimchamp jimchamp merged commit c6f6c6c into internetarchive:master Jan 8, 2024
3 checks passed
@jimchamp
Copy link
Collaborator

jimchamp commented Jan 8, 2024

No worries! Thanks for making those changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Re-enable autofill on add new book form
2 participants