Closed tarunima closed 6 months ago
Reply to Query 457
Somehow this response had not been sent out. From what I could tell it was an oversight. All i did was click on the "approve response" button in the dashboard. and then initiate the send function through code.
outbox = Repo.get(Outbox, "e07f8686-135a-4354-8b3c-91ebbc632a2e")
UserMessage.send_response(outbox)
Reply to Query 473
Background There was no matching template response for this user since the user's preferred language was hindi. Till we whitelist responses in hindi, we are defaulting to replying in English but that feature is not exposed in the portal. So we need to generate the template and set response using code.
common = Repo.get(Common, 473)
template = Factory.process(common)
meta = template.meta
new_meta = Map.put(meta, :template_name, "not_ai_generated_wo_ar_0fc_en")
new_template = Map.put(template, :meta, new_meta)
Factory.eval(new_template)
{:ok, text} = Factory.eval(new_template)
Feed.add_user_response(473, text)
common = Repo.get(Common, 473)
UserMessage.add_response_to_outbox(common)
outbox = Repo.get(Outbox, "b246ffbc-d4bf-41b0-be8d-21b66db576bc")
UserMessage.send_response(outbox)
Result, all the tasks on the dashboard are done. After we hit send we havent received any delivery report from Gupshup. This means the message didn't get delivered to the user. We've raised a ticket with gupshup.
Issue in Query 485 and 486
possible reason why this could be happening
Issue in query 498 and 499.
The secratariat mistaken approved the response for both the queries even when there was no matching template for it. These posts were given the label "manipulated", an assessment report was attached, 2,3 fact check articles were added and the secratariat approved those articles. There is no matching template for the scenario of "manipulated with assessment report and fact check articles" because it was decided that if a manipulated post has an assessment report, the fact check articles will be added to the article and not the user response.
Side Note : Given that this mistake of approving a response even when a matching template is not present makes me think that the "Approve Response" button should not be clickable when there is no matching template. This would make this even less error prone.
Solution The first thing to do is to remove the approval for articles using the dashboard.
Then for both posts I regenerated the template response and stored in the database
For query 498
common = Repo.get(Common, 498)
template = Factory.process(common)
{:ok, text} = Factory.eval(template)
Feed.add_user_response(498, text)
outbox = Repo.get(Outbox, "1e4e26af-c240-40d1-b9b6-3f8fda2d105a")
outbox |> cast(%{text: text}, [:text]) |> Repo.update
outbox = Repo.get(Outbox, "1e4e26af-c240-40d1-b9b6-3f8fda2d105a")
UserMessage.send_response(outbox)
Delivery Report 000 : DELIVERED : SUCCESS : 5149229920172109907-1e4e26af-c240-40d1-b9b6-3f8fda2d105a
For query 499
common = Repo.get(Common, 499)
template = Factory.process(common)
{:ok, text} = Factory.eval(template)
Feed.add_user_response(499, text)
outbox = Repo.get(Outbox, "8678c7d1-668f-411f-b58d-019b0fb5ba93")
outbox |> cast(%{text: text}, [:text]) |> Repo.update
outbox = Repo.get(Outbox, "8678c7d1-668f-411f-b58d-019b0fb5ba93")
UserMessage.send_response(outbox)
Delivery Report 000 : DELIVERED : SUCCESS : 5149231862406516819-8678c7d1-668f-411f-b58d-019b0fb5ba93
We eventually got the following delivery report for 473 026 : READ : READ : 5148479698382426195-b246ffbc-d4bf-41b0-be8d-21b66db576bc
Task : updated reply_type to notification for 508 and 513
508
import Ecto.Changeset
outbox = Repo.get(Outbox, "8f6c7705-9ac0-4c2e-a4cd-401e77bcebcf")
outbox |> cast(%{reply_type: :notification}, [:reply_type]) |> Repo.update
513
outbox = Repo.get(Outbox, "8d7eef96-ec14-4aa8-b61e-f26f328cce8a")
outbox |> cast(%{reply_type: :notification}, [:reply_type]) |> Repo.update
Delivery Report for Query 532 says
101 : FAILED : 24HR_TimeExceed : 5155587669424558126-d07ead1f-6249-4f84-85e4-41156ace7e4f
Updated the reply_type field to be "notification" instead of :customer_reply and send the message.
Repo.get(Outbox, "d07ead1f-6249-4f84-85e4-41156ace7e4f") |> cast(%{reply_type: :notification}, [:reply_type]) |> Repo.update
outbox = Repo.get(Outbox, "d07ead1f-6249-4f84-85e4-41156ace7e4f")
UserMessage.send_response(outbox)
closing this issue. Continuing here: https://github.com/tattle-made/DAU/issues/109
Reply to Query 495
Background The DAU secratariat mistakenly approved the user response before it matched any template. Then two fact check articles were also added to it. Since we lock the user response field once the secratariate approves the response, this query was stuck in a state where user could not be responded to. The task for tattle was to manually generate the template response, store it in the apt field and send out the user response.
Commands used :