twilio-ruby
twilio-ruby copied to clipboard
cant update query sample_id without having duplicate sample in 2 tasks
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
- update sample_id to the query (create sample_1 with tagged_text for task_1 and add sample_1 to query)
- update sample_id to the query (create sample_2 with tagged_text for task_2 and add sample_2 to query)
- 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
if samples need task_id to be fetched then you should include task_id in any response object that has sample_id!
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.
Hello @shwetha-manvinkurke , thank you for your respond, here is the example:
-
I am assigning "Bye" to "no_emergency" task
-
I am assigning "Bye" to "emergency" task
-
now both "no_emergency" and "emergency" tasks have "Bye" assigned to them!
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!