Skip to content

Commit

Permalink
Merge pull request #611 from praekeltfoundation/TBH-720-bug-incorrect…
Browse files Browse the repository at this point in the history
…-response-after-replying-no-to-soft-commitment

changed next state for endstate to state_start
  • Loading branch information
Buhle79 authored Oct 18, 2023
2 parents 41c266f + 27f9881 commit 5f95ea8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions go-app-ussd_tb_check.js
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ go.app = function () {

self.states.add("state_commit_to_get_tested_no", function(name) {
return new EndState(name, {
next: "state_submit_test_commit",
next: "state_start",
text: $([
"Even if you can’t commit now, it is still important to get tested.",
].join("\n")
Expand Down Expand Up @@ -1171,7 +1171,7 @@ go.app = function () {

var payload = {
data: {
commit_get_tested: answers.state_commit_to_get_tested ? "yes" : "no",
commit_get_tested: answers.state_commit_to_get_tested === "state_commit_to_get_tested_yes" ? "yes" : "no",
"source": "USSD",
clinic_visit_day: answers.clinic_visit_day,
},
Expand All @@ -1184,7 +1184,7 @@ go.app = function () {
.patch(self.im.config.healthcheck.url + "/v2/tbcheck/"+ id +"/", payload)
.then(
function () {
if (answers.state_commit_to_get_tested){
if (answers.state_commit_to_get_tested === "state_commit_to_get_tested_yes"){
return self.states.create("state_commitment");
}
else{
Expand Down
6 changes: 3 additions & 3 deletions src/ussd_tb_check.js
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ go.app = function () {

self.states.add("state_commit_to_get_tested_no", function(name) {
return new EndState(name, {
next: "state_submit_test_commit",
next: "state_start",
text: $([
"Even if you can’t commit now, it is still important to get tested.",
].join("\n")
Expand Down Expand Up @@ -1054,7 +1054,7 @@ go.app = function () {

var payload = {
data: {
commit_get_tested: answers.state_commit_to_get_tested ? "yes" : "no",
commit_get_tested: answers.state_commit_to_get_tested === "state_commit_to_get_tested_yes" ? "yes" : "no",
"source": "USSD",
clinic_visit_day: answers.clinic_visit_day,
},
Expand All @@ -1067,7 +1067,7 @@ go.app = function () {
.patch(self.im.config.healthcheck.url + "/v2/tbcheck/"+ id +"/", payload)
.then(
function () {
if (answers.state_commit_to_get_tested){
if (answers.state_commit_to_get_tested === "state_commit_to_get_tested_yes"){
return self.states.create("state_commitment");
}
else{
Expand Down
4 changes: 2 additions & 2 deletions test/ussd_tb_check.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2122,7 +2122,7 @@ describe("ussd_tb_check app", function () {
.state("state_submit_test_commit")
.setup.user.answers({
tbcheck_id: 22,
state_commit_to_get_tested: true,
state_commit_to_get_tested: "state_commit_to_get_tested_yes",
})
.setup(function (api) {
api.http.fixtures.add({
Expand Down Expand Up @@ -2155,7 +2155,7 @@ describe("ussd_tb_check app", function () {
.state("state_submit_test_commit")
.setup.user.answers({
tbcheck_id: 22,
state_commit_to_get_tested: false,
state_commit_to_get_tested: "state_submit_test_commit",
})
.setup(function (api) {
api.http.fixtures.add({
Expand Down

0 comments on commit 5f95ea8

Please sign in to comment.