From a9929f4f6b2051b5a76145d03d7b6edfb8e5f862 Mon Sep 17 00:00:00 2001 From: Laryn Qi Date: Mon, 30 Sep 2024 09:54:08 -0400 Subject: [PATCH] add courseId --- client/protocols/help.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/client/protocols/help.py b/client/protocols/help.py index d8c32945..143d4b34 100644 --- a/client/protocols/help.py +++ b/client/protocols/help.py @@ -49,11 +49,25 @@ class HelpProtocol(models.Protocol): UNKNOWN_EMAIL = '' BOT_PREFIX = '[61A-bot]: ' HELP_PROMPT = BOT_PREFIX + "Would you like to receive debugging help (d) or help understanding the problem (p)? You can also type a specific question.\nPress return/enter to receive no help. Type \"never\" to turn off 61a-bot for this assignment." + CS61A_ENDPOINT = 'cs61a' + C88C_ENDPOINT = 'c88c' + CS61A_ID = '61a' + C88C_ID = '88c' + UNKNOWN_COURSE = '' def run(self, messages): config = config_utils._get_config(self.args.config) if 'help' not in config.get('protocols', []): return + + okpy_endpoint = config.get('endpoint', '') + if self.CS61A_ENDPOINT in okpy_endpoint: + course_id = self.CS61A_ID + elif self.C88C_ENDPOINT in okpy_endpoint: + course_id = self.C88C_ID + else: + course_id = self.UNKNOWN_COURSE + tests = self.assignment.specified_tests grading_analytics = messages.get('grading', {}) failed = False @@ -94,6 +108,7 @@ def run(self, messages): 'consent': consent, 'messages': context + [curr_message], 'studentQuery': student_query, + 'courseId': course_id, } elif res in self.DISABLE_HELP_OPTIONS: self._set_disabled(email, disabled=True)