Skip to content

Commit b465620

Browse files
committed
Final fix for adding users...
1 parent 1eede2f commit b465620

File tree

5 files changed

+26
-29
lines changed

5 files changed

+26
-29
lines changed

src/python/add_update_member.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def process_role_data(parsed: Dict, prefix: str = "") -> Optional[Dict]:
5353
if affiliation and affiliation != "_No response_":
5454
role["affiliation"] = affiliation
5555

56-
research_directions = parsed.get(f"{prefix}research-directions")
56+
research_directions = parsed.get(f"{prefix}research_directions")
5757
if research_directions and research_directions != "_No response_":
5858
# Handle both string and list inputs for research directions
5959
if isinstance(research_directions, str):
@@ -74,12 +74,12 @@ def format_parsed_content(parsed: Dict) -> Dict:
7474
}
7575

7676
# Process current role
77-
current_role = process_role_data(parsed, "current_role-")
77+
current_role = process_role_data(parsed, "current_role_")
7878
if current_role:
7979
formatted["current_role"] = current_role
8080

8181
# Process past role if it exists (for updates)
82-
past_role = process_role_data(parsed, "past_role-")
82+
past_role = process_role_data(parsed, "past_role_")
8383
if past_role:
8484
formatted["past_roles"] = past_role
8585

tests/data/add_member/in.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,36 @@ _No response_
1414

1515
_No response_
1616

17-
### Semantic_scholar_id
17+
### Semantic Scholar ID
1818

19-
_No response_
19+
145113126
2020

21-
### Auto_update_publications
21+
### Auto Update Publications
2222

23-
False
23+
True
2424

25-
### Current_role-type
25+
### Current Role Type
2626

2727
Student
2828

29-
### Current_role-title
29+
### Current Role Title
3030

3131
PhD
3232

33-
### Current_role-affiliation
33+
### Current Role Affiliation
3434

3535
Mila, McGill
3636

37-
### Current_role-research-directions
37+
### Current Role Research Directions
3838

3939
online-toxicity, poli-sci
4040

4141

42-
### Current_role-advisor
42+
### Current Role Advisor
4343

4444
Reihaneh Rabbany
4545

46-
### Current_role-start_date
46+
### Current Role Start Date
4747

4848
Fall 2019
4949

tests/data/add_member/out.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"name": "John Doe",
33
"avatar": "/tests/scratch/assets/images/bio/John Doe.jpg",
4-
"auto_update_publications": false,
4+
"semantic_scholar_id": "145113126",
5+
"auto_update_publications": true,
56
"current_role": {
67
"type": "Student",
78
"title": "PhD",

tests/data/update_member/in.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,27 @@ Allergic to reviewer 2
1818

1919
145113126
2020

21-
### Auto_update_publications
21+
### Auto Update Publications
2222

2323
True
2424

25-
### Current_role-type
25+
### Current Role Type
2626

2727
Unaffiliated
2828

29-
### Current_role-title
29+
### Current Role Title
3030

3131
Professing at Leland S. Junior University
3232

33-
### Current_role-research-directions
33+
### Current Role Research Directions
3434

3535
online-toxicity, poli-sci, online-crime
3636

37-
### Current_role-advisor
37+
### Current Role Advisor
3838

3939
_No response_
4040

41-
### Current_role-start_date
41+
### Current Role Start Date
4242

4343
_No response_
4444

@@ -62,22 +62,22 @@ https://www.linkedin.com/in/fake_user/
6262

6363
_No response_
6464

65-
### Past_role-type
65+
### Past Role Type
6666

6767
Student
6868

69-
### Past_role-title
69+
### Past Role Title
7070

7171
PhD
7272

73-
### Past_role-advisor
73+
### Past Role Advisor
7474

7575
Reihaneh Rabbany
7676

77-
### Past_role-start_date
77+
### Past Role Start Date
7878

7979
Fall 2019
8080

81-
### Past_role-end_date
81+
### Past Role End Date
8282

8383
Winter 2023

tests/test_add_update_member.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ def test_add_member(self):
4747

4848
output = json.loads(json.dumps(out['John Doe']))
4949

50-
print(output)
51-
print(expected)
5250
self.assertEqual(output, expected)
5351

5452
def test_update_member(self):
@@ -73,8 +71,6 @@ def test_update_member(self):
7371

7472
error_message = f"\n\n!!! Expected content of generated file to match content of file {exp_out_path}, but they did not match !!!"
7573

76-
print(output)
77-
print(expected)
7874
self.assertEqual(output, expected, error_message)
7975

8076

0 commit comments

Comments
 (0)