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

Calculate CI with distributions when scrolled into view #16

Closed
wants to merge 12 commits into from

Conversation

musicin3d
Copy link
Collaborator

At the moment, this is just a proof of concept. It loads distributions, calculates the CI, and dumps the information to the page. It also highlights the product tile when it's finished.

There are a few bugs that still need to be worked out.

@musicin3d musicin3d changed the title Calc CI with distributions onscroll Calculate CI with distributions when scrolled into view Mar 28, 2020
@chrismbryant
Copy link
Owner

This is pretty cool! I like the functionality

@musicin3d musicin3d marked this pull request as ready for review March 30, 2020 04:13
@musicin3d musicin3d requested a review from aeciorc March 30, 2020 04:13
@musicin3d
Copy link
Collaborator Author

I reorganized inject.js, so it with conflict with Chris's pull request... #19

@chrismbryant
Copy link
Owner

I reorganized inject.js, so it with conflict with Chris's pull request... #19

The changes I made to inject.js were pretty minor, so the conflicts should be pretty easy to resolve

… process of calculating proportion before evaluating. Minor doc fixes. Corrected order of ratings in distribution
@musicin3d
Copy link
Collaborator Author

Resolved conflicts and fixed bugs. This is ready for final review.

Tagging: #9

@musicin3d
Copy link
Collaborator Author

musicin3d commented Apr 5, 2020

I don't know if this is a regression or a new bug. At https://www.amazon.com/s?me=A3EPIN8KW1GGQX&marketplaceID=ATVPDKIKX0DER the scraping fails almost entirely.

Edit: It's a regression. I'll fix it.

@aeciorc
Copy link
Collaborator

aeciorc commented Apr 7, 2020

Sorry about delay in reviewing this, should be able to check it out this evening

src/shared/scraper.js Show resolved Hide resolved
run()
}
function run(){
//TODO sometimes products are featured together, and this selects the entire block instead of each product
Copy link
Collaborator

Choose a reason for hiding this comment

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

I noticed it also doesn't work when you're searching within a category, eg: https://www.amazon.ca/s?k=notes&i=alexa-skills&ref=nb_sb_noss

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like this is the same issue you pointed out earlier

const leftover = []
for(let product of noDistProducts) {
if (productInView(product)){
// noinspection JSIgnoredPromiseFromCall
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't you also check for product.reviews? I noticed that in products without reviews, the avg viz doesn't get added, but a blank dist viz does

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good find! I've pushed an update that filters out those products before setting noDistProducts

@musicin3d
Copy link
Collaborator Author

I'll try to resolve all issues tomorrow night.

@musicin3d
Copy link
Collaborator Author

Closing due to the revelation in #10 (comment)

@musicin3d musicin3d closed this Apr 24, 2020
@musicin3d musicin3d deleted the calc-onscroll branch April 24, 2020 03:48
@musicin3d musicin3d restored the calc-onscroll branch April 24, 2020 03:49
@chrismbryant
Copy link
Owner

@musicin3d you don’t think it still might be worth taking this approach even if we do use the average star rating? Especially if we want to offer a mode where the visualization is injected into the popover?

@musicin3d
Copy link
Collaborator Author

musicin3d commented Apr 24, 2020 via email

@chrismbryant
Copy link
Owner

I see, thanks for clarifying. Yeah I don’t imagine we’d be doing any expensive calculations

@aeciorc
Copy link
Collaborator

aeciorc commented Apr 28, 2020

Hey @musicin3d, the changes you made in refactoring the scraping are still interesting even if didn't end up benefitting from using the distributions. So I think there's value in merging some of the commits in this PR to master 😛

@musicin3d
Copy link
Collaborator Author

musicin3d commented Apr 28, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants