Skip to content

Commit

Permalink
Merge pull request #156 from ToucanToco/fix/aircall-connector-calls-d…
Browse files Browse the repository at this point in the history
…atasource

Aircall: fix "calls" datasource
  • Loading branch information
vdestraitt authored Apr 23, 2020
2 parents 3d16583 + 56d8e46 commit 845c869
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/aircall/test_aircall.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def test__retrieve_data_no_teams_case(con, mocker):
# must have calls and still have a team column even if everything is NaN
assert run_fetches_mock.call_count == 1
assert df.shape == (10, 11)
assert df['team'].isna().any()
assert df['team'].isin(['NO TEAM']).all()


def test__retrieve_tags_from_fetch(con, mocker):
Expand Down
2 changes: 1 addition & 1 deletion tests/aircall/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_build_calls_df():
fake_list_of_data_3 = [empty_df, empty_var_df, calls_df]
df_3 = build_df('calls', fake_list_of_data_3)
assert df_3.shape == (10, 11)
assert df_3['team'].isna().all()
assert df_3['team'].isin(['NO TEAM']).all()

# empty arrays
fake_list_of_data_4 = [empty_df, empty_var_df, empty_var_df]
Expand Down
1 change: 1 addition & 0 deletions toucan_connectors/aircall/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def build_df(dataset: str, list_of_data: List[dict]) -> pd.DataFrame:
answered_at=lambda t: pd.to_datetime(t['answered_at'], unit='s'),
ended_at=lambda t: pd.to_datetime(t['ended_at'], unit='s'),
day=lambda t: t['ended_at'].astype(str).str[:10],
team=lambda x: x['team'].replace({np.NaN: 'NO TEAM'}),
)
return total_df[COLUMN_DICTIONARY[dataset]]

Expand Down

0 comments on commit 845c869

Please sign in to comment.