Skip to content

Search by catalog number in user's collection: add the simplest implementation #1098

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

Closed
php-coder opened this issue Jul 22, 2019 · 6 comments
Assignees
Labels
estimation/30m Estimated time: 30 minutes kind/task Task that is part of some feature
Milestone

Comments

@php-coder
Copy link
Owner

php-coder commented Jul 22, 2019

Here is the simplest implementation that even doesn't introduce new methods:

  • modify SeriesController.searchSeriesByCatalog() method to do the following:
    • after search for series in database (see switch) but right before passing the results to a view (model.addAttribute())
      • if feature is enabled
      • and if checkbox is selected
      • and if a user isn't anonymous
      • iterate over results and filter out the series that a user doesn't have in its collection (use CollectionService.isSeriesInCollection())

Yeah, this is kind of ugly, use extra memory, leads to N+1 query to database but it's fastest approach to implement without adding a lot of code.

This is part of #673

@php-coder php-coder added the kind/task Task that is part of some feature label Jul 22, 2019
@php-coder php-coder added this to the 0.4.1 milestone Jul 22, 2019
@mukeshk
Copy link
Contributor

mukeshk commented Jul 23, 2019

I looked at the model SeriesInfoDto which is returned by the repository. We have an Id attribute in there.
This Id attribute needs to be checked against the User Series.

  1. How do we know about the Series in a User collection?
  2. Did not find CollectionSeries.isSeriesInCollection() method ?

@php-coder
Copy link
Owner Author

php-coder commented Jul 23, 2019

Did not find CollectionSeries.isSeriesInCollection() method ?

Whoops, I meant CollectionService:

boolean isSeriesInCollection(Integer userId, Integer seriesId);

@php-coder
Copy link
Owner Author

How do we know about the Series in a User collection?

CollectionService.isSeriesInCollection() method should help us -- we provide a user and a series and it gives an answer to the question "whether this series in a collection of this user".

@mukeshk
Copy link
Contributor

mukeshk commented Jul 23, 2019 via email

@php-coder
Copy link
Owner Author

Ok. This means we need to iterate over records and call the api for each
record. Collect the matching elements and send in the response.

Yes, that's correct.

Do we have a batch API to check the series id?

Not yet. Could be added in one of the iterations later.

At this point, we'll check one by one.

mukeshk added a commit to mukeshk/mystamps that referenced this issue Jul 24, 2019
mukeshk added a commit to mukeshk/mystamps that referenced this issue Jul 24, 2019
mukeshk added a commit to mukeshk/mystamps that referenced this issue Jul 24, 2019
mukeshk added a commit to mukeshk/mystamps that referenced this issue Jul 24, 2019
mukeshk added a commit to mukeshk/mystamps that referenced this issue Jul 24, 2019
mukeshk added a commit to mukeshk/mystamps that referenced this issue Jul 24, 2019
mukeshk added a commit to mukeshk/mystamps that referenced this issue Jul 24, 2019
mukeshk added a commit to mukeshk/mystamps that referenced this issue Jul 24, 2019
mukeshk added a commit to mukeshk/mystamps that referenced this issue Jul 24, 2019
mukeshk added a commit to mukeshk/mystamps that referenced this issue Jul 24, 2019
php-coder added a commit that referenced this issue Jul 24, 2019
First it's deprecated (see #1018).
Second, it blocks me to merge fix for #1098 because it complains on inCollection variable that is
totally readable to me.

[skip ci]
@0pdd
Copy link

0pdd commented Jul 24, 2019

@php-coder the puzzle #1101 is still not solved.

@php-coder php-coder added the estimation/30m Estimated time: 30 minutes label Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
estimation/30m Estimated time: 30 minutes kind/task Task that is part of some feature
Projects
None yet
Development

No branches or pull requests

3 participants