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

Disallow updating rows more than once #9

Open
tinok opened this issue Oct 13, 2020 · 3 comments
Open

Disallow updating rows more than once #9

tinok opened this issue Oct 13, 2020 · 3 comments
Assignees

Comments

@tinok
Copy link
Member

tinok commented Oct 13, 2020

We need to modify the script so that it skips the initial KoBo-to-Airtable submission IF the row already includes a UUID in the Airtable COL submission_uuid field.

Background

The current online survey approach has some users forwarding the survey URL (including the "unique" participant ID) to whole groups of people. This means that:

  • There may be multiple KoBo submissions for the same participant ID, each resulting in a new set of referred contacts
  • Each successive submission with the same participant ID is resulting in the reward phone number being overwritten

For example:

  1. Alex takes survey (respondent ID 1), refers Tino (ID 2).
  2. Tino receives survey URL, and forwards it by group message. He also takes the survey, referring John and Ignacio, adding his phone number for rewards (111-222-3333).
  3. Anji takes the survey from the URL Tino forwarded in step 2. He refers Patrick and Katrina. He specifies his reward phone number (234-400-5000).

Current behavior:

Tino's phone number is replaced by Anji's. Patrick and Katrina are added as new referrals to the table. There are now 5 records (Alex, Tino, John, Ignacio, Patrick, Katrina). Tino's record says he referred 4 people (John, Ignacio, Patrick, Katrina).

Desired behavior: One of these two options:

  1. Patrick and Katrina are not added to Airtable
  2. Patrick and Katrina are added but the record updating script DOES NOT update Tino's record (because he already has a UUID in the Airtable COL submission_uuid field). (This would require the team filtering out the additional referrals in Airtable, which is ok.)
@dorey dorey self-assigned this Oct 17, 2020
@dorey
Copy link
Contributor

dorey commented Oct 21, 2020

In this example, would it work if we check to see if Tino has a referral number set, and if it is set we don't change it? This seems like it would prevent the underlying problem.

And then we could add Patrick and Katrina in and (somehow) mark them as coming from an over-submitted referral link which would make it easier to filter out

@jnm
Copy link
Member

jnm commented Oct 22, 2020

@dorey, sounds good to me 👍

I'd guess that this issue is making a bit of a mess in the Airtable, so pushing a fix first for

we check to see if Tino has a referral number set, and if it is set we don't change it

would probably save a lot of labor. The next part

mark them as coming from an over-submitted referral link

is certainly nice, but please don't worry about doing this first. Perhaps, given what @tinok says, it's not needed at all.

dorey added a commit that referenced this issue Oct 22, 2020
* include 'PARENT_UUID' in the queried fields
* if PARENT_UUID is already set, then emit an error

addresses #9

Needs to be tested on the live airtable

Question--
Does req.emit('error') prevent the rest of the airtable update from 
continuing?
@tinok
Copy link
Member Author

tinok commented Oct 24, 2020

That's right, adding Patrick and Katrina is not necessary from their perspective. This was only a suggestion in the first post because we're already adding them.

Once Patrick and Katrina don't have Tino's referral number set anymore we will know that they came from an overcommitted referral and can filter them out as needed.

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

No branches or pull requests

3 participants