Skip to content

Commit

Permalink
change state
Browse files Browse the repository at this point in the history
  • Loading branch information
DevChima committed Jan 29, 2025
1 parent 0d5492b commit 9fef9a5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 25 deletions.
12 changes: 1 addition & 11 deletions go-app-ussd_public_rapidpro.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ go.app = function() {
} else if(_.inRange(_.get(contact, "fields.prebirth_messaging"), 1, 7)) {
return self.states.create("state_clinic_subscription");
} else if(_.toUpper(_.get(contact, "fields.postbirth_messaging")) === "TRUE"){
return self.states.create("state_postbirth_subscription");
return self.states.create("state_clinic_subscription");
}
else {
return self.states.create("state_pregnant");
Expand Down Expand Up @@ -316,16 +316,6 @@ go.app = function() {
});
});

self.states.add("state_postbirth_subscription", function(name) {
return new EndState(name, {
next: "state_start",
text: $(
"Hello mom! You're getting postbirth messages. Reply with questions, compliments, or " +
"complaints. We'll get back to you soon."
)
});
});

self.states.add("state_pregnant", function(name) {
return new MenuState(name, {
question: $(
Expand Down
12 changes: 1 addition & 11 deletions src/ussd_public_rapidpro.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ go.app = function() {
} else if(_.inRange(_.get(contact, "fields.prebirth_messaging"), 1, 7)) {
return self.states.create("state_clinic_subscription");
} else if(_.toUpper(_.get(contact, "fields.postbirth_messaging")) === "TRUE"){
return self.states.create("state_postbirth_subscription");
return self.states.create("state_clinic_subscription");
}
else {
return self.states.create("state_pregnant");
Expand Down Expand Up @@ -152,16 +152,6 @@ go.app = function() {
});
});

self.states.add("state_postbirth_subscription", function(name) {
return new EndState(name, {
next: "state_start",
text: $(
"Hello mom! You're getting postbirth messages. Reply with questions, compliments, or " +
"complaints. We'll get back to you soon."
)
});
});

self.states.add("state_pregnant", function(name) {
return new MenuState(name, {
question: $(
Expand Down
6 changes: 3 additions & 3 deletions test/ussd_public_rapidpro.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ describe("ussd_public app", function() {
})
.start()
.check.interaction({
state: "state_postbirth_subscription",
state: "state_clinic_subscription",
reply:
"Hello mom! You're getting postbirth messages. Reply with questions, compliments, or " +
"complaints. We'll get back to you soon."
"Hello mom! You can reply to any MomConnect message with a question, compliment or complaint. Our team " +
"will get back to you as soon as they can."
})
.run();
});
Expand Down

0 comments on commit 9fef9a5

Please sign in to comment.