Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SKIL-202 #675

Closed
wants to merge 168 commits into from
Closed

SKIL-202 #675

wants to merge 168 commits into from

Conversation

ebanderson3
Copy link
Contributor

TODOs completed:

  • Backend now uses MySQL to host databases

Copy link
Collaborator

@aparriaran aparriaran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ebanderson3 LGTM!

ebanderson3 and others added 4 commits September 14, 2024 16:45
…pdated README.md by adding information for how to install mysql on MacOS and start it!
… uri! Updated __init__.py by adding logic to use the new environment variables to create the correct mysql db uri! Updated dbcreate.py by removing no longer needed db.drop_all() and replaced os.abort() with raise e to provide a way to debug the errors better in docker compose logs! Updated run.py by removing no longer needed comments! Updated setupEnv.py by adding the error log of the exception raised by trying to run a command in cmd()! Updated compose.yml by adding logic for creating a new mysql docker image and container! Also added logic to persist mysql data even when running docker compose down! Also added logic so that the backend service will only run if mysql is ready to accept connections to allow the backend service to connect and initialize the db! Updated Dockerfile.backend by removing the logic to run the -d flag while building the backend docker image and instead run it when the docker image is executed to create a docker container!
Copy link
Contributor

@jcallison1 jcallison1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the docker compose stuff seems to work fine, however when I tried to complete an assessment task the backend had multiple errors:

Backend Log
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:08:59] "GET /api/course?user_id=2 HTTP/1.1" 422 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:09:08] "GET /api/course?user_id=2 HTTP/1.1" 422 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:11] "POST /api/[email protected]&password=demo_admin HTTP/1.1" 200 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:11] "POST /api/[email protected]&password=demo_admin HTTP/1.1" 200 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:12] "GET /api/course?user_id=2 HTTP/1.1" 200 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:14] "GET /api/role?&user_id=2 HTTP/1.1" 200 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:14] "GET /api/user?course_id=1&user_id=2 HTTP/1.1" 200 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:16] "GET /api/role?&user_id=2 HTTP/1.1" 200 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:16] "GET /api/assessment_task?course_id=1&user_id=2 HTTP/1.1" 200 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:16] "GET /api/rubric?all=true&user_id=2 HTTP/1.1" 200 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:19] "GET /api/rubric?rubric_id=4&user_id=2 HTTP/1.1" 200 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:20] "GET /api/role?user_id=2&course_id=1&user_id=2 HTTP/1.1" 200 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:20] "GET /api/checkin?assessment_task_id=4&user_id=2 HTTP/1.1" 200 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:20] "GET /api/team_by_user?user_id=2&course_id=1&user_id=2 HTTP/1.1" 200 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:20] "GET /api/user?course_id=1&role_id=5&user_id=2 HTTP/1.1" 200 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:20] "GET /api/team?course_id=1&user_id=2 HTTP/1.1" 200 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:20] "GET /api/completed_assessment?assessment_task_id=4&unit=individual&user_id=2 HTTP/1.1" 200 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:20] "GET /api/rubric?rubric_id=4&user_id=2 HTTP/1.1" 200 -
backend-1   | 2024-09-17 15:10:30,326 - ERROR - /app/models/utility.py 71 Error Type: IntegrityError Message: (pymysql.err.IntegrityError) (1452, 'Cannot add or update a child row: a foreign key constraint fails (`account`.`CompletedAssessment`, CONSTRAINT `CompletedAssessment_ibfk_3` FOREIGN KEY (`team_id`) REFERENCES `Team` (`team_id`))')
backend-1   | [SQL: INSERT INTO `CompletedAssessment` (assessment_task_id, completed_by, team_id, user_id, initial_time, last_update, rating_observable_characteristics_suggestions_data, done) VALUES (%(assessment_task_id)s, %(completed_by)s, %(team_id)s, %(user_id)s, %(initial_time)s, %(last_update)s, %(rating_observable_characteristics_suggestions_data)s, %(done)s)]
backend-1   | [parameters: {'assessment_task_id': 4, 'completed_by': 2, 'team_id': -1, 'user_id': 9, 'initial_time': datetime.datetime(2024, 9, 17, 15, 10, 29, 794000), 'last_update': datetime.datetime(2024, 9, 17, 15, 10, 29, 794000), 'rating_observable_characteristics_suggestions_data': '{"Listening": {"comments": "", "description": "Paid attention to the speaker as information and ideas were communicated", "observable_characteristics ... (634 characters truncated) ... "0": "No evidence", "1": "Rarely", "2": "", "3": "Sometimes", "4": "", "5": "Consistently"}, "suggestions": "000000"}, "done": false, "comments": ""}', 'done': 0}]
backend-1   | (Background on this error at: https://sqlalche.me/e/20/gkpj)
backend-1   | 2024-09-17 15:10:30,371 - ERROR - Bad response sent: user_id: 2, content type: completed_assessments, msg: An error occurred creating a new completed assessment (pymysql.err.IntegrityError) (1452, 'Cannot add or update a child row: a foreign key constraint fails (`account`.`CompletedAssessment`, CONSTRAINT `CompletedAssessment_ibfk_3` FOREIGN KEY (`team_id`) REFERENCES `Team` (`team_id`))')
backend-1   | [SQL: INSERT INTO `CompletedAssessment` (assessment_task_id, completed_by, team_id, user_id, initial_time, last_update, rating_observable_characteristics_suggestions_data, done) VALUES (%(assessment_task_id)s, %(completed_by)s, %(team_id)s, %(user_id)s, %(initial_time)s, %(last_update)s, %(rating_observable_characteristics_suggestions_data)s, %(done)s)]
backend-1   | [parameters: {'assessment_task_id': 4, 'completed_by': 2, 'team_id': -1, 'user_id': 9, 'initial_time': datetime.datetime(2024, 9, 17, 15, 10, 29, 794000), 'last_update': datetime.datetime(2024, 9, 17, 15, 10, 29, 794000), 'rating_observable_characteristics_suggestions_data': '{"Listening": {"comments": "", "description": "Paid attention to the speaker as information and ideas were communicated", "observable_characteristics ... (634 characters truncated) ... "0": "No evidence", "1": "Rarely", "2": "", "3": "Sometimes", "4": "", "5": "Consistently"}, "suggestions": "000000"}, "done": false, "comments": ""}', 'done': 0}]
backend-1   | (Background on this error at: https://sqlalche.me/e/20/gkpj), status: 400, error raised from function: add_completed_assessment
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:30] "POST /api/completed_assessment?uid=9&assessment_task_id=4&user_id=2 HTTP/1.1" 400 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:31] "GET /api/completed_assessment?assessment_task_id=4&unit=individual&user_id=2 HTTP/1.1" 200 -
backend-1   | 2024-09-17 15:10:34,683 - ERROR - /app/models/utility.py 71 Error Type: IntegrityError Message: (pymysql.err.IntegrityError) (1452, 'Cannot add or update a child row: a foreign key constraint fails (`account`.`CompletedAssessment`, CONSTRAINT `CompletedAssessment_ibfk_3` FOREIGN KEY (`team_id`) REFERENCES `Team` (`team_id`))')
backend-1   | [SQL: INSERT INTO `CompletedAssessment` (assessment_task_id, completed_by, team_id, user_id, initial_time, last_update, rating_observable_characteristics_suggestions_data, done) VALUES (%(assessment_task_id)s, %(completed_by)s, %(team_id)s, %(user_id)s, %(initial_time)s, %(last_update)s, %(rating_observable_characteristics_suggestions_data)s, %(done)s)]
backend-1   | [parameters: {'assessment_task_id': 4, 'completed_by': 2, 'team_id': -1, 'user_id': 9, 'initial_time': datetime.datetime(2024, 9, 17, 15, 10, 34, 154000), 'last_update': datetime.datetime(2024, 9, 17, 15, 10, 34, 154000), 'rating_observable_characteristics_suggestions_data': '{"Listening": {"comments": "", "description": "Paid attention to the speaker as information and ideas were communicated", "observable_characteristics ... (634 characters truncated) ... "0": "No evidence", "1": "Rarely", "2": "", "3": "Sometimes", "4": "", "5": "Consistently"}, "suggestions": "000000"}, "done": false, "comments": ""}', 'done': 0}]
backend-1   | (Background on this error at: https://sqlalche.me/e/20/gkpj)
backend-1   | 2024-09-17 15:10:34,684 - ERROR - Bad response sent: user_id: 2, content type: completed_assessments, msg: An error occurred creating a new completed assessment (pymysql.err.IntegrityError) (1452, 'Cannot add or update a child row: a foreign key constraint fails (`account`.`CompletedAssessment`, CONSTRAINT `CompletedAssessment_ibfk_3` FOREIGN KEY (`team_id`) REFERENCES `Team` (`team_id`))')
backend-1   | [SQL: INSERT INTO `CompletedAssessment` (assessment_task_id, completed_by, team_id, user_id, initial_time, last_update, rating_observable_characteristics_suggestions_data, done) VALUES (%(assessment_task_id)s, %(completed_by)s, %(team_id)s, %(user_id)s, %(initial_time)s, %(last_update)s, %(rating_observable_characteristics_suggestions_data)s, %(done)s)]
backend-1   | [parameters: {'assessment_task_id': 4, 'completed_by': 2, 'team_id': -1, 'user_id': 9, 'initial_time': datetime.datetime(2024, 9, 17, 15, 10, 34, 154000), 'last_update': datetime.datetime(2024, 9, 17, 15, 10, 34, 154000), 'rating_observable_characteristics_suggestions_data': '{"Listening": {"comments": "", "description": "Paid attention to the speaker as information and ideas were communicated", "observable_characteristics ... (634 characters truncated) ... "0": "No evidence", "1": "Rarely", "2": "", "3": "Sometimes", "4": "", "5": "Consistently"}, "suggestions": "000000"}, "done": false, "comments": ""}', 'done': 0}]
backend-1   | (Background on this error at: https://sqlalche.me/e/20/gkpj), status: 400, error raised from function: add_completed_assessment
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:34] "POST /api/completed_assessment?uid=9&assessment_task_id=4&user_id=2 HTTP/1.1" 400 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:35] "GET /api/completed_assessment?assessment_task_id=4&unit=individual&user_id=2 HTTP/1.1" 200 -
backend-1   | 2024-09-17 15:10:37,946 - ERROR - /app/models/utility.py 71 Error Type: IntegrityError Message: (pymysql.err.IntegrityError) (1452, 'Cannot add or update a child row: a foreign key constraint fails (`account`.`CompletedAssessment`, CONSTRAINT `CompletedAssessment_ibfk_3` FOREIGN KEY (`team_id`) REFERENCES `Team` (`team_id`))')
backend-1   | [SQL: INSERT INTO `CompletedAssessment` (assessment_task_id, completed_by, team_id, user_id, initial_time, last_update, rating_observable_characteristics_suggestions_data, done) VALUES (%(assessment_task_id)s, %(completed_by)s, %(team_id)s, %(user_id)s, %(initial_time)s, %(last_update)s, %(rating_observable_characteristics_suggestions_data)s, %(done)s)]
backend-1   | [parameters: {'assessment_task_id': 4, 'completed_by': 2, 'team_id': -1, 'user_id': 9, 'initial_time': datetime.datetime(2024, 9, 17, 15, 10, 37, 424000), 'last_update': datetime.datetime(2024, 9, 17, 15, 10, 37, 424000), 'rating_observable_characteristics_suggestions_data': '{"Listening": {"comments": "", "description": "Paid attention to the speaker as information and ideas were communicated", "observable_characteristics ... (634 characters truncated) ... "0": "No evidence", "1": "Rarely", "2": "", "3": "Sometimes", "4": "", "5": "Consistently"}, "suggestions": "000000"}, "done": false, "comments": ""}', 'done': 0}]
backend-1   | (Background on this error at: https://sqlalche.me/e/20/gkpj)
backend-1   | 2024-09-17 15:10:37,948 - ERROR - Bad response sent: user_id: 2, content type: completed_assessments, msg: An error occurred creating a new completed assessment (pymysql.err.IntegrityError) (1452, 'Cannot add or update a child row: a foreign key constraint fails (`account`.`CompletedAssessment`, CONSTRAINT `CompletedAssessment_ibfk_3` FOREIGN KEY (`team_id`) REFERENCES `Team` (`team_id`))')
backend-1   | [SQL: INSERT INTO `CompletedAssessment` (assessment_task_id, completed_by, team_id, user_id, initial_time, last_update, rating_observable_characteristics_suggestions_data, done) VALUES (%(assessment_task_id)s, %(completed_by)s, %(team_id)s, %(user_id)s, %(initial_time)s, %(last_update)s, %(rating_observable_characteristics_suggestions_data)s, %(done)s)]
backend-1   | [parameters: {'assessment_task_id': 4, 'completed_by': 2, 'team_id': -1, 'user_id': 9, 'initial_time': datetime.datetime(2024, 9, 17, 15, 10, 37, 424000), 'last_update': datetime.datetime(2024, 9, 17, 15, 10, 37, 424000), 'rating_observable_characteristics_suggestions_data': '{"Listening": {"comments": "", "description": "Paid attention to the speaker as information and ideas were communicated", "observable_characteristics ... (634 characters truncated) ... "0": "No evidence", "1": "Rarely", "2": "", "3": "Sometimes", "4": "", "5": "Consistently"}, "suggestions": "000000"}, "done": false, "comments": ""}', 'done': 0}]
backend-1   | (Background on this error at: https://sqlalche.me/e/20/gkpj), status: 400, error raised from function: add_completed_assessment
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:37] "POST /api/completed_assessment?uid=9&assessment_task_id=4&user_id=2 HTTP/1.1" 400 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:38] "GET /api/completed_assessment?assessment_task_id=4&unit=individual&user_id=2 HTTP/1.1" 200 -
backend-1   | 2024-09-17 15:10:42,548 - ERROR - /app/models/utility.py 71 Error Type: IntegrityError Message: (pymysql.err.IntegrityError) (1452, 'Cannot add or update a child row: a foreign key constraint fails (`account`.`CompletedAssessment`, CONSTRAINT `CompletedAssessment_ibfk_3` FOREIGN KEY (`team_id`) REFERENCES `Team` (`team_id`))')
backend-1   | [SQL: INSERT INTO `CompletedAssessment` (assessment_task_id, completed_by, team_id, user_id, initial_time, last_update, rating_observable_characteristics_suggestions_data, done) VALUES (%(assessment_task_id)s, %(completed_by)s, %(team_id)s, %(user_id)s, %(initial_time)s, %(last_update)s, %(rating_observable_characteristics_suggestions_data)s, %(done)s)]
backend-1   | [parameters: {'assessment_task_id': 4, 'completed_by': 2, 'team_id': -1, 'user_id': 9, 'initial_time': datetime.datetime(2024, 9, 17, 15, 10, 42, 20000), 'last_update': datetime.datetime(2024, 9, 17, 15, 10, 42, 20000), 'rating_observable_characteristics_suggestions_data': '{"Listening": {"comments": "", "description": "Paid attention to the speaker as information and ideas were communicated", "observable_characteristics ... (634 characters truncated) ... "0": "No evidence", "1": "Rarely", "2": "", "3": "Sometimes", "4": "", "5": "Consistently"}, "suggestions": "000000"}, "done": false, "comments": ""}', 'done': 0}]
backend-1   | (Background on this error at: https://sqlalche.me/e/20/gkpj)
backend-1   | 2024-09-17 15:10:42,549 - ERROR - Bad response sent: user_id: 2, content type: completed_assessments, msg: An error occurred creating a new completed assessment (pymysql.err.IntegrityError) (1452, 'Cannot add or update a child row: a foreign key constraint fails (`account`.`CompletedAssessment`, CONSTRAINT `CompletedAssessment_ibfk_3` FOREIGN KEY (`team_id`) REFERENCES `Team` (`team_id`))')
backend-1   | [SQL: INSERT INTO `CompletedAssessment` (assessment_task_id, completed_by, team_id, user_id, initial_time, last_update, rating_observable_characteristics_suggestions_data, done) VALUES (%(assessment_task_id)s, %(completed_by)s, %(team_id)s, %(user_id)s, %(initial_time)s, %(last_update)s, %(rating_observable_characteristics_suggestions_data)s, %(done)s)]
backend-1   | [parameters: {'assessment_task_id': 4, 'completed_by': 2, 'team_id': -1, 'user_id': 9, 'initial_time': datetime.datetime(2024, 9, 17, 15, 10, 42, 20000), 'last_update': datetime.datetime(2024, 9, 17, 15, 10, 42, 20000), 'rating_observable_characteristics_suggestions_data': '{"Listening": {"comments": "", "description": "Paid attention to the speaker as information and ideas were communicated", "observable_characteristics ... (634 characters truncated) ... "0": "No evidence", "1": "Rarely", "2": "", "3": "Sometimes", "4": "", "5": "Consistently"}, "suggestions": "000000"}, "done": false, "comments": ""}', 'done': 0}]
backend-1   | (Background on this error at: https://sqlalche.me/e/20/gkpj), status: 400, error raised from function: add_completed_assessment
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:42] "POST /api/completed_assessment?uid=9&assessment_task_id=4&user_id=2 HTTP/1.1" 400 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:43] "GET /api/completed_assessment?assessment_task_id=4&unit=individual&user_id=2 HTTP/1.1" 200 -
backend-1   | 2024-09-17 15:10:56,024 - ERROR - /app/models/utility.py 71 Error Type: IntegrityError Message: (pymysql.err.IntegrityError) (1452, 'Cannot add or update a child row: a foreign key constraint fails (`account`.`CompletedAssessment`, CONSTRAINT `CompletedAssessment_ibfk_3` FOREIGN KEY (`team_id`) REFERENCES `Team` (`team_id`))')
backend-1   | [SQL: INSERT INTO `CompletedAssessment` (assessment_task_id, completed_by, team_id, user_id, initial_time, last_update, rating_observable_characteristics_suggestions_data, done) VALUES (%(assessment_task_id)s, %(completed_by)s, %(team_id)s, %(user_id)s, %(initial_time)s, %(last_update)s, %(rating_observable_characteristics_suggestions_data)s, %(done)s)]
backend-1   | [parameters: {'assessment_task_id': 4, 'completed_by': 2, 'team_id': -1, 'user_id': 9, 'initial_time': datetime.datetime(2024, 9, 17, 15, 10, 55, 492000), 'last_update': datetime.datetime(2024, 9, 17, 15, 10, 55, 492000), 'rating_observable_characteristics_suggestions_data': '{"Listening": {"comments": "", "description": "Paid attention to the speaker as information and ideas were communicated", "observable_characteristics ... (634 characters truncated) ... "0": "No evidence", "1": "Rarely", "2": "", "3": "Sometimes", "4": "", "5": "Consistently"}, "suggestions": "000000"}, "done": false, "comments": ""}', 'done': 0}]
backend-1   | (Background on this error at: https://sqlalche.me/e/20/gkpj)
backend-1   | 2024-09-17 15:10:56,025 - ERROR - Bad response sent: user_id: 2, content type: completed_assessments, msg: An error occurred creating a new completed assessment (pymysql.err.IntegrityError) (1452, 'Cannot add or update a child row: a foreign key constraint fails (`account`.`CompletedAssessment`, CONSTRAINT `CompletedAssessment_ibfk_3` FOREIGN KEY (`team_id`) REFERENCES `Team` (`team_id`))')
backend-1   | [SQL: INSERT INTO `CompletedAssessment` (assessment_task_id, completed_by, team_id, user_id, initial_time, last_update, rating_observable_characteristics_suggestions_data, done) VALUES (%(assessment_task_id)s, %(completed_by)s, %(team_id)s, %(user_id)s, %(initial_time)s, %(last_update)s, %(rating_observable_characteristics_suggestions_data)s, %(done)s)]
backend-1   | [parameters: {'assessment_task_id': 4, 'completed_by': 2, 'team_id': -1, 'user_id': 9, 'initial_time': datetime.datetime(2024, 9, 17, 15, 10, 55, 492000), 'last_update': datetime.datetime(2024, 9, 17, 15, 10, 55, 492000), 'rating_observable_characteristics_suggestions_data': '{"Listening": {"comments": "", "description": "Paid attention to the speaker as information and ideas were communicated", "observable_characteristics ... (634 characters truncated) ... "0": "No evidence", "1": "Rarely", "2": "", "3": "Sometimes", "4": "", "5": "Consistently"}, "suggestions": "000000"}, "done": false, "comments": ""}', 'done': 0}]
backend-1   | (Background on this error at: https://sqlalche.me/e/20/gkpj), status: 400, error raised from function: add_completed_assessment
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:56] "POST /api/completed_assessment?uid=9&assessment_task_id=4&user_id=2 HTTP/1.1" 400 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:10:57] "GET /api/completed_assessment?assessment_task_id=4&unit=individual&user_id=2 HTTP/1.1" 200 -
backend-1   | 2024-09-17 15:11:00,517 - ERROR - /app/models/utility.py 71 Error Type: IntegrityError Message: (pymysql.err.IntegrityError) (1452, 'Cannot add or update a child row: a foreign key constraint fails (`account`.`CompletedAssessment`, CONSTRAINT `CompletedAssessment_ibfk_3` FOREIGN KEY (`team_id`) REFERENCES `Team` (`team_id`))')
backend-1   | [SQL: INSERT INTO `CompletedAssessment` (assessment_task_id, completed_by, team_id, user_id, initial_time, last_update, rating_observable_characteristics_suggestions_data, done) VALUES (%(assessment_task_id)s, %(completed_by)s, %(team_id)s, %(user_id)s, %(initial_time)s, %(last_update)s, %(rating_observable_characteristics_suggestions_data)s, %(done)s)]
backend-1   | [parameters: {'assessment_task_id': 4, 'completed_by': 2, 'team_id': -1, 'user_id': 9, 'initial_time': datetime.datetime(2024, 9, 17, 15, 10, 59, 985000), 'last_update': datetime.datetime(2024, 9, 17, 15, 10, 59, 985000), 'rating_observable_characteristics_suggestions_data': '{"Listening": {"comments": "", "description": "Paid attention to the speaker as information and ideas were communicated", "observable_characteristics ... (634 characters truncated) ... "0": "No evidence", "1": "Rarely", "2": "", "3": "Sometimes", "4": "", "5": "Consistently"}, "suggestions": "000000"}, "done": false, "comments": ""}', 'done': 1}]
backend-1   | (Background on this error at: https://sqlalche.me/e/20/gkpj)
backend-1   | 2024-09-17 15:11:00,518 - ERROR - Bad response sent: user_id: 2, content type: completed_assessments, msg: An error occurred creating a new completed assessment (pymysql.err.IntegrityError) (1452, 'Cannot add or update a child row: a foreign key constraint fails (`account`.`CompletedAssessment`, CONSTRAINT `CompletedAssessment_ibfk_3` FOREIGN KEY (`team_id`) REFERENCES `Team` (`team_id`))')
backend-1   | [SQL: INSERT INTO `CompletedAssessment` (assessment_task_id, completed_by, team_id, user_id, initial_time, last_update, rating_observable_characteristics_suggestions_data, done) VALUES (%(assessment_task_id)s, %(completed_by)s, %(team_id)s, %(user_id)s, %(initial_time)s, %(last_update)s, %(rating_observable_characteristics_suggestions_data)s, %(done)s)]
backend-1   | [parameters: {'assessment_task_id': 4, 'completed_by': 2, 'team_id': -1, 'user_id': 9, 'initial_time': datetime.datetime(2024, 9, 17, 15, 10, 59, 985000), 'last_update': datetime.datetime(2024, 9, 17, 15, 10, 59, 985000), 'rating_observable_characteristics_suggestions_data': '{"Listening": {"comments": "", "description": "Paid attention to the speaker as information and ideas were communicated", "observable_characteristics ... (634 characters truncated) ... "0": "No evidence", "1": "Rarely", "2": "", "3": "Sometimes", "4": "", "5": "Consistently"}, "suggestions": "000000"}, "done": false, "comments": ""}', 'done': 1}]
backend-1   | (Background on this error at: https://sqlalche.me/e/20/gkpj), status: 400, error raised from function: add_completed_assessment
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:11:00] "POST /api/completed_assessment?uid=9&assessment_task_id=4&user_id=2 HTTP/1.1" 400 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:11:01] "GET /api/completed_assessment?assessment_task_id=4&unit=individual&user_id=2 HTTP/1.1" 200 -
backend-1   | 2024-09-17 15:11:18,794 - ERROR - /app/models/utility.py 71 Error Type: IntegrityError Message: (pymysql.err.IntegrityError) (1452, 'Cannot add or update a child row: a foreign key constraint fails (`account`.`CompletedAssessment`, CONSTRAINT `CompletedAssessment_ibfk_3` FOREIGN KEY (`team_id`) REFERENCES `Team` (`team_id`))')
backend-1   | [SQL: INSERT INTO `CompletedAssessment` (assessment_task_id, completed_by, team_id, user_id, initial_time, last_update, rating_observable_characteristics_suggestions_data, done) VALUES (%(assessment_task_id)s, %(completed_by)s, %(team_id)s, %(user_id)s, %(initial_time)s, %(last_update)s, %(rating_observable_characteristics_suggestions_data)s, %(done)s)]
backend-1   | [parameters: {'assessment_task_id': 4, 'completed_by': 2, 'team_id': -1, 'user_id': 9, 'initial_time': datetime.datetime(2024, 9, 17, 15, 11, 18, 264000), 'last_update': datetime.datetime(2024, 9, 17, 15, 11, 18, 264000), 'rating_observable_characteristics_suggestions_data': '{"Listening": {"comments": "", "description": "Paid attention to the speaker as information and ideas were communicated", "observable_characteristics ... (634 characters truncated) ... "0": "No evidence", "1": "Rarely", "2": "", "3": "Sometimes", "4": "", "5": "Consistently"}, "suggestions": "000000"}, "done": false, "comments": ""}', 'done': 1}]
backend-1   | (Background on this error at: https://sqlalche.me/e/20/gkpj)
backend-1   | 2024-09-17 15:11:18,795 - ERROR - Bad response sent: user_id: 2, content type: completed_assessments, msg: An error occurred creating a new completed assessment (pymysql.err.IntegrityError) (1452, 'Cannot add or update a child row: a foreign key constraint fails (`account`.`CompletedAssessment`, CONSTRAINT `CompletedAssessment_ibfk_3` FOREIGN KEY (`team_id`) REFERENCES `Team` (`team_id`))')
backend-1   | [SQL: INSERT INTO `CompletedAssessment` (assessment_task_id, completed_by, team_id, user_id, initial_time, last_update, rating_observable_characteristics_suggestions_data, done) VALUES (%(assessment_task_id)s, %(completed_by)s, %(team_id)s, %(user_id)s, %(initial_time)s, %(last_update)s, %(rating_observable_characteristics_suggestions_data)s, %(done)s)]
backend-1   | [parameters: {'assessment_task_id': 4, 'completed_by': 2, 'team_id': -1, 'user_id': 9, 'initial_time': datetime.datetime(2024, 9, 17, 15, 11, 18, 264000), 'last_update': datetime.datetime(2024, 9, 17, 15, 11, 18, 264000), 'rating_observable_characteristics_suggestions_data': '{"Listening": {"comments": "", "description": "Paid attention to the speaker as information and ideas were communicated", "observable_characteristics ... (634 characters truncated) ... "0": "No evidence", "1": "Rarely", "2": "", "3": "Sometimes", "4": "", "5": "Consistently"}, "suggestions": "000000"}, "done": false, "comments": ""}', 'done': 1}]
backend-1   | (Background on this error at: https://sqlalche.me/e/20/gkpj), status: 400, error raised from function: add_completed_assessment
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:11:18] "POST /api/completed_assessment?uid=9&assessment_task_id=4&user_id=2 HTTP/1.1" 400 -
backend-1   | 172.18.0.1 - - [17/Sep/2024 15:11:19] "GET /api/completed_assessment?assessment_task_id=4&unit=individual&user_id=2 HTTP/1.1" 200 -

To Reproduce:

  1. Click the Complete button for Critical Thinking Assessment in Operating Systems.
  2. Select anyone (Liam Walker for example).
  3. Check any of the checkboxes and let it auto-save.
  4. Errors appear in the backend log.

It's possible I didn't run everything correctly, I just did docker compose build and then docker compose up. Do I need to do anything else to set up MySQL correctly?

@ebanderson3
Copy link
Contributor Author

There is currently an integrity error when saving completed AT.

@ebanderson3 ebanderson3 removed the request for review from brianlugo1 October 6, 2024 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants