Skip to content

Commit 6c4c214

Browse files
committed
Fix add users
1 parent 3556055 commit 6c4c214

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

src/python/add_update_member.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,13 @@ def process_role_data(parsed: Dict, prefix: str = "") -> Optional[Dict]:
5555

5656
research_directions = parsed.get(f"{prefix}research-directions")
5757
if research_directions and research_directions != "_No response_":
58-
print(research_directions)
59-
role["research_directions"] = [
60-
direction.strip()
61-
for direction in research_directions.split('-')
62-
if direction.strip()
63-
]
58+
# Handle both string and list inputs for research directions
59+
if isinstance(research_directions, str):
60+
# Split by commas if it's a comma-separated string
61+
directions = [d.strip() for d in research_directions.split(',')]
62+
else:
63+
directions = research_directions
64+
role["research_directions"] = directions
6465

6566
return role
6667

tests/data/add_member/in.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Mila, McGill
3636

3737
### Current_role-research-directions
3838

39-
online-toxicity, temporal-graph-learning
39+
online-toxicity, poli-sci
4040

4141

4242
### Current_role-advisor

tests/data/add_member/out.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"affiliation": "Mila, McGill",
99
"research_directions": [
1010
"online-toxicity",
11-
"temporal-graph-learning"
11+
"poli-sci"
1212
],
1313
"advisor": "Reihaneh Rabbany",
1414
"start_date": "Fall 2019"

tests/test_add_update_member.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ def tearDownClass(cls) -> None:
3434
if os.path.exists(path):
3535
shutil.rmtree(path)
3636

37-
def test_add_member(self):
37+
def test_add_member(self):
38+
self.maxDiff = None
3839
with open("tests/data/add_member/in.md") as f:
3940
issue_body = f.read()
4041

@@ -45,6 +46,9 @@ def test_add_member(self):
4546
expected = json.load(f)
4647

4748
output = json.loads(json.dumps(out['John Doe']))
49+
50+
print(output)
51+
print(expected)
4852
self.assertEqual(output, expected)
4953

5054
def test_update_member(self):

0 commit comments

Comments
 (0)