Get user answers to guiding questions (NEW: matching UI version)
(self, questions_json: str)
| 868 | print(questions_json) |
| 869 | |
| 870 | def get_question_answers(self, questions_json: str) -> dict: |
| 871 | """Get user answers to guiding questions (NEW: matching UI version)""" |
| 872 | import json |
| 873 | |
| 874 | try: |
| 875 | questions = json.loads(questions_json) |
| 876 | answers = {} |
| 877 | |
| 878 | print( |
| 879 | f"\n{Colors.BOLD}{Colors.BLUE}📝 Answer the following questions:{Colors.ENDC}" |
| 880 | ) |
| 881 | print( |
| 882 | f"{Colors.CYAN}(Type your answer and press Enter for each question){Colors.ENDC}\n" |
| 883 | ) |
| 884 | |
| 885 | for i, question in enumerate(questions, 1): |
| 886 | print( |
| 887 | f"\n{Colors.BOLD}{Colors.YELLOW}Q{i}:{Colors.ENDC} {Colors.CYAN}{question}{Colors.ENDC}" |
| 888 | ) |
| 889 | print(f"{Colors.BOLD}{Colors.OKCYAN}Your answer:{Colors.ENDC} ", end="") |
| 890 | |
| 891 | answer = input().strip() |
| 892 | answers[f"question_{i}"] = answer |
| 893 | |
| 894 | if answer: |
| 895 | self.print_status(f"Answer {i} recorded", "success") |
| 896 | else: |
| 897 | self.print_status(f"Answer {i} left blank", "warning") |
| 898 | |
| 899 | return answers |
| 900 | |
| 901 | except json.JSONDecodeError: |
| 902 | self.print_status("Failed to parse questions", "error") |
| 903 | return {} |
| 904 | |
| 905 | def display_requirement_summary(self, summary: str): |
| 906 | """Display generated requirement document (NEW: matching UI version)""" |
no test coverage detected