Last active
February 19, 2021 04:16
-
-
Save mtreacy002/8ade2c86a63accc9c087c7095568c03e to your computer and use it in GitHub Desktop.
BIT Mentorship relation flow - Organization request mentor/mentee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for mentorship_relations dummy data | |
# 1st scenario. | |
# Program send request to mentor and mentee | |
# prepare empty tasks_list for mentorship_relation1 | |
tasks_list_1 = TasksListModel() | |
db.session.add(tasks_list_1) | |
db.session.commit() | |
# create mentorship_relation1 when program sending request to mentor | |
mentorship_relation1 = MentorshipRelationModel( | |
action_user_id=organization2.rep_id, | |
mentor_user=user1, | |
mentee_user=None, | |
creation_date=1589630400, # Saturday, 16 May 2020 12:00:00 PM UTC+0 | |
end_date=program2.end_date, # Friday, 31 July 2020 9:00:00 AM UTC+0 == program2 end_date | |
state=MentorshipRelationState.PENDING, | |
notes="Please be a mentor...", | |
tasks_list=tasks_list_1, | |
) | |
mentorship_relation1.start_date = ( | |
program2.start_date | |
) # Thursday, 21 May 2020 12:00:00 PM UTC+0 | |
db.session.add(mentorship_relation1) | |
db.session.commit() | |
# initiate mentorship_relations_extension | |
mentorship_relations_extension1 = MentorshipRelationExtensionModel( | |
program_id=program2.id, mentorship_relation_id=mentorship_relation1.id | |
) | |
mentorship_relations_extension1.mentor_request_date = ( | |
mentorship_relation1.creation_date | |
) | |
db.session.add(mentorship_relations_extension1) | |
db.session.commit() | |
# later, mentor accepted program request | |
mentorship_relation1.action_id = user1.id | |
mentorship_relation1.notes = "ok, will do." | |
mentorship_relations_extension1.mentor_agreed_date = ( | |
1589803200 # Monday, 18 May 2020 12:00:00 PM UTC+0 | |
) | |
# update related tables | |
db.session.add(mentorship_relation1) | |
db.session.add(mentorship_relations_extension1) | |
db.session.commit() | |
# then program send request to mentee | |
mentorship_relation1.action_id = organization2.rep_id | |
mentorship_relation1.mentee_id = user2.id | |
mentorship_relation1.notes = "You're invited to work with us as a mentee." | |
mentorship_relations_extension1.mentee_request_date = ( | |
1589803200 # Monday, 18 May 2020 12:00:00 PM UTC+0 | |
) | |
# update related tables | |
db.session.add(mentorship_relation1) | |
db.session.add(mentorship_relations_extension1) | |
db.session.commit() | |
# mentee accepted program request | |
mentorship_relation1.action_id = user2.id | |
mentorship_relation1.notes = "sure, why not." | |
mentorship_relations_extension1.mentee_agreed_date = ( | |
1589976000 # Wednesday, 20 May 2020 12:00:00 PM UTC+0 | |
) | |
# update mentorship_relation state | |
mentorship_relation1.state = MentorshipRelationState.ACCEPTED | |
mentorship_relation1.accept_date = ( | |
mentorship_relations_extension1.mentee_agreed_date | |
) | |
# update program status | |
program2.status = ProgramStatus.IN_PROGRESS | |
# update related tables | |
db.session.add(mentorship_relation1) | |
db.session.add(mentorship_relations_extension1) | |
db.session.add(program2) | |
db.session.commit() | |
# create list of tasks assigned at the beginning of the program | |
tasks_list_1_task_a = "this is task a for tasks list 1" | |
tasks_list_1_task_b = "this is task b for tasks list 1" | |
tasks_list_1.add_task( | |
description=tasks_list_1_task_a, created_at=1590062400 | |
) # Thursday, 21 May 2020 12:00:00 PM UTC+0 | |
tasks_list_1.add_task( | |
description=tasks_list_1_task_b, created_at=1590062400 | |
) # Thursday, 21 May 2020 12:00:00 PM UTC+0 | |
db.session.add(tasks_list_1) | |
db.session.commit() | |
# mentor comment on task a | |
tasks_list_1_task_comment_a = TaskCommentModel( | |
user_id=user1.id, | |
task_id=1, | |
relation_id=1, | |
comment="Do you need help with the task?", | |
) | |
tasks_list_1_task_comment_a.creation_date = ( | |
1590062400 # Thursday, 21 May 2020 12:00:00 PM UTC+0 == tasks a creation date | |
) | |
db.session.add(tasks_list_1_task_comment_a) | |
db.session.commit() | |
# mentee responded to mentor comment | |
tasks_list_1_task_comment_a.user_id = user2.id | |
tasks_list_1_task_comment_a.comment = "Nope. All good" | |
tasks_list_1_task_comment_a.modification_date = ( | |
1590148800 # Friday, 22 May 2020 12:00:00 PM UTC+0 | |
) | |
db.session.add(tasks_list_1_task_comment_a) | |
db.session.commit() | |
# when the task is completed | |
tasks_list_1.update_task( | |
task_id=1, | |
is_done=True, | |
completed_at=1590235200, # Saturday, 23 May 2020 12:00:00 PM UTC+0 | |
) | |
# mentor add comment on task a completion | |
tasks_list_1_task_comment_a.user_id = user1.id | |
tasks_list_1_task_comment_a.comment = "Well done!" | |
tasks_list_1_task_comment_a.modification_date = ( | |
1590235200 # Saturday, 23 May 2020 12:00:00 PM UTC+0 | |
) | |
db.session.add(tasks_list_1) | |
db.session.add(tasks_list_1_task_comment_a) | |
db.session.commit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment