Skip to content

Commit

Permalink
fix dupe activation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
NickTracker committed Sep 8, 2024
1 parent 7b9bde3 commit e7ff6e1
Show file tree
Hide file tree
Showing 17 changed files with 2,342 additions and 1,512 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Run tests
run: |
pytest -v -s --asyncio-mode=auto app/tests/test_should_parse_activations_async_test.py
pytest -v -s --asyncio-mode=auto app/tests
working-directory: ./server
env:
PYTHONPATH: ${{ github.workspace }}/server
Expand Down
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,25 @@
"args": ["run", "--host=localhost", "--port=8000", "--debug"],
"jinja": true
},
{
"name": "Python: Pytest Asyncio",
"type": "debugpy",
"request": "launch",
"module": "pytest",
"args": [
"-v",
"-s",
"-o",
"asyncio_mode=auto",
"--disable-warnings",
"/Users/nzozaya/Salesforce/io-webapp/server/app/tests"
],
"cwd": "${workspaceFolder}",
"env": {
"PYTHONPATH": "${workspaceFolder}"
},
"console": "integratedTerminal"
},
{
"type": "chrome",
"request": "launch",
Expand Down
4 changes: 2 additions & 2 deletions server/app/data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ class Opportunity(SerializableModel):

class ProspectingMetadata(SerializableModel):
name: str
first_occurrence: date
last_occurrence: date
total: int
first_occurrence: Optional[date] = None
last_occurrence: Optional[date] = None


class ProspectingEffort(SerializableModel):
Expand Down
10 changes: 5 additions & 5 deletions server/app/engine/activation_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ def update_activation_states():
pluck(fetch_accounts_not_in_ids(active_account_ids).data, "id")
)

outbound_prospecting_tasks_by_filter_name = fetch_criteria_tasks_by_account_ids_from_date(
prospecting_tasks_by_filter_name = fetch_criteria_tasks_by_account_ids_from_date(
activatable_account_ids,
f"{get_threshold_date_for_activatable_tasks(settings)}T00:00:00Z",
[criteria for criteria in settings.criteria if criteria.direction.lower() == "outbound"],
settings.criteria,
salesforce_user_ids,
).data

contact_ids = set()
for criteria_name in outbound_prospecting_tasks_by_filter_name:
contact_ids.update(pluck(outbound_prospecting_tasks_by_filter_name[criteria_name], WHO_ID))
for criteria_name in prospecting_tasks_by_filter_name:
contact_ids.update(pluck(prospecting_tasks_by_filter_name[criteria_name], WHO_ID))

contacts = (
fetch_contacts_by_ids_and_non_null_accounts(list(contact_ids)).data
Expand All @@ -77,7 +77,7 @@ def update_activation_states():
)

new_activations = compute_activated_accounts(
outbound_prospecting_tasks_by_filter_name, contacts, settings
prospecting_tasks_by_filter_name, contacts, settings
).data

if len(new_activations) > 0:
Expand Down
Loading

0 comments on commit e7ff6e1

Please sign in to comment.