Skip to content

Instantly share code, notes, and snippets.

View johnnyji's full-sized avatar
🏠
Working from home

Johnny Ji johnnyji

🏠
Working from home
View GitHub Profile

Issue

https://app.asana.com/0/1161712892239265/1202764423803060

Customer is saying that Distru update their LL product quantity to zero and listing status to unavailable, even though there is quantity in Distru.

Investigating

Let's take one of the products mentioned in the ticket "Pharmicated - Pre-Rolls (Flower) - Alien OG - 1g" (ID: 620527) and look at what LL product it's associated to:

User from Company ID: 197968 is not seeing test results auto-populated, despite package saying "TestPassed" on June 13th, package was imported in Distru on July 17th

SELECT metrc_id FROM packages WHERE id = 2713720;

 metrc_id
----------
  6543105
(1 row)

Company had LL order not created in Distru

SELECT leaflink_order_cache_updated_up_until FROM companies WHERE id = 298490;

This tells me that the company's last updated time for the LL order sync was July 28th

SELECT leaflink_id, jsonb_pretty(payload) FROM leaflink_order_caches loc WHERE loc.payload ->>'short_id'='8a5cca4213a' AND archived_at IS NULL;

Issue

Some users in Distru have not had their transfers cache updated since 06/28/2022. An example of this is this Asana ticket.

Data

Impersonate user: yaya+1@flavrhouse.com Order ID not syncing: 495908

Investigation

@johnnyji
johnnyji / string_replacer.js
Last active November 9, 2019 18:20
String Replacer
// Write a function that will take a string with word placeholders (ie. "Hello __NAME__"), and an
// options object (ie. {name: "James"})and return that string with placeholder words replaced by values
// in the options object (ie. "Hello James")
// For this example, we can assume that each __PLACEHOLDER__ in the string will have a corresponding key in the options object.
// So the word `__PLACEHOLDER__` in the string will have a key value of `placeholder` in the options object. Let's look
// at a quick example:
// const string = "James loves to play __SPORT__ on __DAYOFWEEK__"
// const opts = {sport: "soccer", dayOfWeek: "Sunday"};
class Main extends React.Component {
// ...
render() {
// Because we've named the prop `this._handleClick`, we're now passing a FUNCTION REFERENCE and
// no longer creating a new function on every render cycle. The function reference will not change throughout
// the lifecycle of `Main`, therefore it will never cause `Button` to re-render.
return (
<div>
<p>This button has been clicked {count} times</p>
// ...
render() {
return (
<div>
<Button
label='Click me to increment!'
onClicked={this._handleIncrementView}
/>
<Button
// ...
render() {
return (
<div>
<Button
label='Click me to increment!'
onClicked={() => { this.setState({count: this.state.count + 1}) }}
/>
<Button
@johnnyji
johnnyji / anon-function-in-react.js
Created January 16, 2018 22:10
Dirty Anon React Component
class Main extends React.Component {
// ...
render() {
// We should NEVER pass anonymous functions as props to React components unless
// we absolutely need to.
//
// Anonymous functions are redefined on every render cycle, which means
// the function you pass to your child component is different every time.
//