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

Recalc total verse equivalents saved as NaN #2920

Merged
merged 1 commit into from
Oct 28, 2023

Conversation

atGit2021
Copy link
Contributor

@atGit2021 atGit2021 commented Oct 25, 2023

@CarsonF could you help me with the cypher query? I'm getting back an empty array, so not sure how to pull ScriptureRange for both the scriptureReferences (Direct Scripture Products) and the scriptureReferencesOverride (Derivative Scripture Products) as a collection.

┆Issue is synchronized with this Monday item by Unito

@atGit2021 atGit2021 self-assigned this Oct 25, 2023
@atGit2021 atGit2021 requested a review from CarsonF as a code owner October 25, 2023 22:46
Copy link
Member

@CarsonF CarsonF left a comment

Choose a reason for hiding this comment

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

I wouldn't really bother trying to duplicate that. You already pull it again anyways with the readOneUnsecured
I'd just:

const ids = await this.db.query()
  .match([
    node('product', 'Product', { active: true }),
    relation('out', '', 'totalVerseEquivalents', ACTIVE),
    node('tve', 'Property'),
  ])
  .raw('WHERE tve.hadNaN = true or isNaN(tve.value)')
  .return<{ id: ID }>('product.id as id')
  .map('id')
  .run();
const products = await this.productService.readManyUnsecured(ids, this.fakeAdminSession);
for (const product of products) {
  const totalVerseEquivalents = // TODO recalc
  await this.productService.updateDirect({ id: product.id, totalVerseEquivalents });
  ...
}

@CarsonF CarsonF marked this pull request as draft October 26, 2023 02:13
@CarsonF CarsonF changed the title Created Migration file to update total verse equivalents property Recalc total verse equivalents saved as NaN Oct 26, 2023
@atGit2021 atGit2021 marked this pull request as ready for review October 27, 2023 15:13
Copy link
Contributor

@bryanjnelson bryanjnelson left a comment

Choose a reason for hiding this comment

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

@atGit2021 - Looks good outside of my comment (that I don't know the answer to).

@CarsonF - Over to you for a Cypher check.

Copy link
Member

@CarsonF CarsonF left a comment

Choose a reason for hiding this comment

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

LGTM!

@atGit2021 atGit2021 force-pushed the 0754-totalVerseEquivalent-Migration branch from 6aff542 to eda959f Compare October 28, 2023 19:36
@atGit2021 atGit2021 merged commit 0f74304 into develop Oct 28, 2023
@atGit2021 atGit2021 deleted the 0754-totalVerseEquivalent-Migration branch October 28, 2023 19:49
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