File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 12
12
SCOPE = ["https://spreadsheets.google.com/feeds" , "https://www.googleapis.com/auth/drive" ]
13
13
CREDS_FILE = "credentials.json"
14
14
15
+ def mentor_mentee_map (db :Session ):
16
+ mentors = (
17
+ db .query (models .User ).filter (models .User .role == "mentor" ).all ()
18
+ )
19
+ mentees = (
20
+ db .query (models .User ).filter (models .User .role == "mentee" ).all ()
21
+ )
22
+
23
+ for mentor in mentors :
24
+ for mentee in mentees :
25
+ if not db .query (models .MentorMenteeMap ).filter_by (mentor_id = mentor .id , mentee_id = mentee .id ).first ():
26
+ map_entry = models .MentorMenteeMap (mentor_id = mentor .id , mentee_id = mentee .id )
27
+ db .add (map_entry )
28
+ db .commit ()
29
+ db .refresh (map_entry )
30
+ return "Mentor Mentee Mapping completed successfully"
31
+
15
32
def get_user_by_email (db : Session , email : str ):
16
33
return db .query (models .User ).filter (models .User .email == email ).first ()
17
34
You can’t perform that action at this time.
0 commit comments