penny-university / penny_university

5 stars 6 forks source link

automate match making #387

Closed JnBrymn closed 3 years ago

JnBrymn commented 3 years ago

what

why

closes https://github.com/penny-university/penny_university/issues/299

JnBrymn commented 3 years ago

I'm checking on my QA to see if it works:

from background_task.models import Task
print('\n'.join([f'{t.task_name}: {t.task_params}' for t in Task.objects.all()]))

# this is correct:
# matchmaking.tasks._request_matches_task: [[], {"slack_team_id": "TNJ631DFU"}]

#so we run it
from matchmaking.tasks import _request_matches_task
_request_matches_task.now(**{"slack_team_id": "TNJ631DFU"})

# and it worked and everyone requested a match

# So we check and then run the matches
print('\n'.join([f'{t.task_name}: {t.task_params}' for t in Task.objects.all()]))

# matchmaking.tasks._make_matches_task: [[], {"slack_team_id": "TNJ631DFU"}]
# correct - running it manually

from matchmaking.tasks import _make_matches_task
_make_matches_task.now(**{"slack_team_id": "TNJ631DFU"})
# logged: "make_matches for TNJ631DFU"

Two more steps to go.

JnBrymn commented 3 years ago

If you'll recall, before the break I set up my QA environment to do automated tests and we saw that _request_matches_task worked because Colin, Sydney, Nick and I were able to sign up to meet in a few different channels.

Today I made a couple of small changes and deployed to QA and ran this test there:

>>> from matchmaking.tasks import _make_matches_task, _remind_matches_task
>>> _make_matches_task.now('TNJ631DFU')  # this is me manually calling the the next step which makes the matches

# here's the output
make_matches for TNJ631DFU: ['colin@cpdev.me', 'jfberryman@gmail.com'] in  penny-university
make_matches for TNJ631DFU: ['nick.chouard@gmail.com', 'sydneycnoh@gmail.com'] in  general
set up _remind_matches_task for TNJ631DFU

I looked in slack and it sent me this message image

Then I ran the next step:

>>> _remind_matches_task.now('TNJ631DFU')
remind_matches for TNJ631DFU

And I received this message in slack image

I think I'll deploy it!