twilio-ruby icon indicating copy to clipboard operation
twilio-ruby copied to clipboard

cant update query sample_id without having duplicate sample in 2 tasks

Open navid-farjad opened this issue 3 years ago • 3 comments

Issue Summary

in query object we have sample_id. if someone wants to update this sample id then there is no way to remove the old sample_id from its task as we don't have a task_id in the query object!

Steps to Reproduce

  1. update sample_id to the query (create sample_1 with tagged_text for task_1 and add sample_1 to query)
  2. update sample_id to the query (create sample_2 with tagged_text for task_2 and add sample_2 to query)
  3. now both task_1 and task_2 have the same tagged_text! and from here you can not delete sample_2 as you don't have task_id in the query object!

if there is a way to get sample object from API without task_id this issue is solved but I can see only one way to get it with task_id:

client.autopilot.assistants(company.ai_assistant.assistant_id) .tasks(task_id) .samples(id) .fetch

Technical details:

  • twilio-ruby version: 5.59.0
  • ruby version: 2.7.2

navid-farjad avatar Oct 08 '21 15:10 navid-farjad

if samples need task_id to be fetched then you should include task_id in any response object that has sample_id!

navid-farjad avatar Oct 08 '21 16:10 navid-farjad

Hi @navid-farjad I am not following what this query object is that you are talking about. Can you explain your use case better? Also, you cannot get a sample resource without a task id since the sample resource belongs to a task. Moreover, this is not a helper library specific issue but we can get in touch with the API team if there's a need.

shwetha-manvinkurke avatar Oct 27 '21 21:10 shwetha-manvinkurke

Hello @shwetha-manvinkurke , thank you for your respond, here is the example:

  1. I am assigning "Bye" to "no_emergency" task Screenshot from 2021-11-15 13-38-43

  2. I am assigning "Bye" to "emergency" task Screenshot from 2021-11-15 13-39-55

  3. now both "no_emergency" and "emergency" tasks have "Bye" assigned to them!

Screenshot from 2021-11-15 13-40-30 Screenshot from 2021-11-15 13-40-43

If sample resource belongs to a task then I assume in your DB you have task_id in the sample object! so with sample_id, I can find the step 1 sample object and delete it! otherwise, the logic is wrong!

navid-farjad avatar Nov 15 '21 11:11 navid-farjad