Skip to content

Commit 62420f2

Browse files
fix validator for iphone ordering when replacement is 'yes'
1 parent f44728c commit 62420f2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/browsergym/workarena/tasks/service_catalog.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -754,9 +754,11 @@ def validate(self, page: Page, chat_messages: list[str]) -> tuple[int, bool, str
754754
if requested_item["options"][self.FIELD_NAME_MAPPING["replacement"]] != self.config["replacement"]:
755755
return 0, False, "", {"message": "The requested replacement status is incorrect."}
756756

757-
# TODO: add replacement phone number in data
758-
if requested_item["options"][self.FIELD_NAME_MAPPING["original_phone_number"]] != self.config["original_phone_number"]:
759-
return 0, False, "", {"message": "The requested original phone number is incorrect."}
757+
if self.config["replacement"].lower() == "yes":
758+
entered_phone_number = ''.join(filter(str.isdigit, requested_item["options"][self.FIELD_NAME_MAPPING["original_phone_number"]]))
759+
ground_truth_phone_number = ''.join(filter(str.isdigit, self.config["original_phone_number"]))
760+
if entered_phone_number != ground_truth_phone_number:
761+
return 0, False, "", {"message": "The requested original phone number is incorrect."}
760762

761763
if requested_item["options"][self.FIELD_NAME_MAPPING["color"]] != self.COLOR_MAPPING[self.config["color"]]:
762764
# TODO: display color and config color is not the same

0 commit comments

Comments
 (0)