Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Better null checking #88

Closed
jmgasper opened this issue Sep 21, 2018 · 0 comments
Closed

Better null checking #88

jmgasper opened this issue Sep 21, 2018 · 0 comments

Comments

@jmgasper
Copy link
Collaborator

From the October challenge 1 review:

#77 Bug mentions for backend

In addition to tracking the copilot in the UI and DB, we also need to ensure that the configured value is used when creating tickets. Please ensure that when the copilot is set, it is using the configured copilot handle from the DB, not the owner of the project.

You change

async function getExistingChallengeIdIfExists(event, dbPayment) {
  // check if there is existing active challenge associated with this project
  const existingPayments = await CopilotPayment.findOne({
    project: dbPayment.project,
    username: event.data.copilot.handle,

to

async function getExistingChallengeIdIfExists(event, dbPayment) {
  // check if there is existing active challenge associated with this project
  const existingPayments = await CopilotPayment.findOne({
    project: dbPayment.project,
    username: event.project.copilot,

You should be first checking if copilot is null or not

Same issue as above in this method too

async function _checkAndReSchedule(event, payment) {
  // get all unclosed payments for given project and user
  const existingPending = await CopilotPayment.find({
    project: payment.project,
    username: event.data.copilot.handle,
async function _checkAndReSchedule(event, payment) {
  // get all unclosed payments for given project and user
  const existingPending = await CopilotPayment.find({
    project: payment.project,
    username: event.project.copilot,
    closed: false,
    status: 'challenge_creation_pending'
  });	
jmgasper added a commit that referenced this issue Oct 2, 2018
#89 (major requirement)
#88 (major requirement)
#87 (major requirement)
#86 (major requirement)
#83
#82
#74
#71
#35 (major requirement)
#79 (major requirement)
#76
@jmgasper jmgasper closed this as completed Oct 2, 2018
jmgasper added a commit that referenced this issue Oct 9, 2019
#89 (major requirement)
#88 (major requirement)
#87 (major requirement)
#86 (major requirement)
#83
#82
#74
#71
#35 (major requirement)
#79 (major requirement)
#76
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant