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

Feat/skip simulation #27

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Feat/skip simulation #27

wants to merge 7 commits into from

Conversation

jgfidelis
Copy link
Contributor

What problem is this solving?

How should this be manually tested?

https://fidelis--alssports.myvtex.com/_v/private/[email protected]/graphiql/v1?

query {
  skipped:productSearchNoSimulations(query:"climbing/hardware/Carabiners", map:"c,c,c", hideUnavailableItems: true) {
    products {
      cacheId
      productId
      description
      productName
      productReference
      linkText
      brand
      brandId
      link
      categories
      specificationGroups {
        name
        specifications {
          name
          values
        }
      }
      items {
        itemId
        name
        nameComplete
        complementName
        ean
        variations {
          name
          values
        }
        referenceId {
          Key
          Value
        }
        measurementUnit
        unitMultiplier
        images {
          cacheId
          imageId
          imageLabel
          imageTag
          imageUrl
          imageText
        }
        sellers {
          sellerId
          sellerName
          commertialOffer {
            skippedSimulation
            discountHighlights {
              name
            }
            teasers {
              name
              conditions {
                minimumQuantity
                parameters {
                  name
                  value
                }
              }
              effects {
                parameters {
                  name
                  value
                }
              }
            }
            Installments(criteria: MAX) {
              Value
              InterestRate
              TotalValuePlusInterestRate
              NumberOfInstallments
              Name
            }
            Price
            ListPrice
            PriceWithoutDiscount
            RewardValue
            PriceValidUntil
            AvailableQuantity
          }
        }
      }
      productClusters {
        id
        name
      }
      properties {
        name
        values
      }
    }
    recordsFiltered
    breadcrumb {
      name
      href
    }
  }
  realProducts:productSearch(query:"climbing/hardware/Carabiners", map:"c,c,c", hideUnavailableItems: true) {
    products {
      cacheId
      productId
      description
      productName
      productReference
      linkText
      brand
      brandId
      link
      categories
      specificationGroups {
        name
        specifications {
          name
          values
        }
      }
      items {
        itemId
        name
        nameComplete
        complementName
        ean
        variations {
          name
          values
        }
        referenceId {
          Key
          Value
        }
        measurementUnit
        unitMultiplier
        images {
          cacheId
          imageId
          imageLabel
          imageTag
          imageUrl
          imageText
        }
        sellers {
          sellerId
          sellerName
          commertialOffer {
            skippedSimulation
            discountHighlights {
              name
            }
            teasers {
              name
              conditions {
                minimumQuantity
                parameters {
                  name
                  value
                }
              }
              effects {
                parameters {
                  name
                  value
                }
              }
            }
            Installments(criteria: MAX) {
              Value
              InterestRate
              TotalValuePlusInterestRate
              NumberOfInstallments
              Name
            }
            Price
            ListPrice
            PriceWithoutDiscount
            RewardValue
            PriceValidUntil
            AvailableQuantity
          }
        }
      }
      productClusters {
        id
        name
      }
      properties {
        name
        values
      }
    }
    recordsFiltered
    breadcrumb {
      name
      href
    }
  }
}

Checklist/Reminders

  • Updated README.md.
  • Updated CHANGELOG.md.
  • Linked this PR to a Clubhouse story (if applicable).
  • Updated/created tests (important for bug fixes).
  • Deleted the workspace after merging this PR (if applicable).

Screenshots or example usage

Type of changes

✔️ Type of Change
_ Bug fix
_ New feature
_ Breaking change
_ Technical improvements

Notes

@vtex-io-ci-cd
Copy link

vtex-io-ci-cd bot commented Nov 1, 2019

Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖

Please select which version do you want to release:

  • Patch

  • Minor

  • Major

And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.

  • No thanks, I would rather do it manually 😞

@vtex-io-docs-bot
Copy link

Beep boop 🤖

I noticed you're not using the Docs Builder properly yet, if you need help to set that up please go to IO Documentation

}

public productsRaw = (args: SearchArgs) => {
return this.getRaw<SearchProduct[]>(this.productSearchUrl(args), {
metric: 'search-products',
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe change metric name to be different from products

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its supposed to be the same thing, just had to do this for typings. Its still hitting the same url with the same variables. For me, it should be the same. I will ask for a third opinion.

)
}

const products = await search.products(args)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't you add skipSimulation = true to the args

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice catch

...product,
items: product.items.map(item => ({
...item,
skippedSimulation: !!skipSimulation,
Copy link
Contributor

Choose a reason for hiding this comment

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

Skip simulation is a boolean, !! isn't needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it might be null or undefined, lets say someone pass the wrong value in the resolver above the tree. I think this is safer.

vwraposo
vwraposo previously approved these changes Nov 4, 2019
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.

2 participants