Conversation
IMO I think you should go with the former (though the difference in work is pretty significant). Seems less hacky and wouldn't leak too much information (example: And it would set the precedent for similar things in the future. |
bobheadxi
left a comment
There was a problem hiding this comment.
nice progress! 🎉
(also, it seems your commit authors arent attached to your GitHub, not sure if intentional?)
app/scheduler/modules/pairing.py
Outdated
| def get_job_args(self) -> Dict[str, Any]: | ||
| """Get job configuration arguments for apscheduler.""" | ||
| return {'trigger': 'cron', | ||
| 'minute': '*', |
There was a problem hiding this comment.
I'm guessing this is just temporary for testing, but could also just make this a configuration option! SLACK_PAIRING_FREQUENCY for example
There was a problem hiding this comment.
Alrighty made it an env variable as a cron job string... not the cleanest so happy for recommendations!
Codecov Report
@@ Coverage Diff @@
## master #553 +/- ##
==========================================
- Coverage 93.01% 92.46% -0.55%
==========================================
Files 42 44 +2
Lines 2420 2589 +169
Branches 323 346 +23
==========================================
+ Hits 2251 2394 +143
- Misses 110 131 +21
- Partials 59 64 +5
Continue to review full report at Codecov.
|
|
OK I got some time to work on this again (after like 20 days 😢) and Added a few tests. I think this is ready for a round of review so I'll change it from a draft. My next focus will be docs and addressing any feedback that pops up. No rush on the review, we are all busy and this is decently large. |
bobheadxi
left a comment
There was a problem hiding this comment.
Fantastic progress, really excited to see this land! Thanks for taking the time to do this ❤️
| self.bot.send_to_channel("Hello! \ | ||
| You have been matched by Rocket \ | ||
| please use this channel to get to know each other!", | ||
| group_name) |
There was a problem hiding this comment.
I wonder if we should have a configuration option SLACK_PAIRING_TIPS_LINK that can generate a button that links to tips for what to do in a pairing (i.e. "set up video call, talk about x and y") - for Launch Pad this could be a handbook page, for example
There was a problem hiding this comment.
Hmmm Can we do this on a follow up or do ya think it's important? Could be a really good first issue for someone!
There was a problem hiding this comment.
Yep! Can you add all the TODO items for follow-up issues in the PR description as a checklist, to make sure we don't forget?
Co-authored-by: Robert Lin <robertlin1@gmail.com>
chuck-sys
left a comment
There was a problem hiding this comment.
Really good job on this! Seems to just need the docs now.
| self.bot.send_to_channel("Hello! \ | ||
| You have been matched by Rocket \ | ||
| please use this channel to get to know each other!", |
There was a problem hiding this comment.
That's a long string. Can you put it refactor it to be a static member for easy changing?
| Creates pairs of users that haven't been matched before | ||
|
|
||
| :param users: A list of slack ids of all users to match | ||
|
|
||
| If a pairing cannot be done, then the history of pairings is | ||
| purged, and the algorithm is run again. |
There was a problem hiding this comment.
Talk about what kind of algorithm is used here please.
| not_paired = list( | ||
| filter(lambda user: user not in already_added, users)) |
There was a problem hiding this comment.
| not_paired = list( | |
| filter(lambda user: user not in already_added, users)) | |
| not_paired = [user for user in users if user not in already_added] |
Feel free to not use this. I just want everything to fit nicely on one line.
P Y T h O n I C
| self.user1_slack_id = user1_slack_id | ||
| self.user2_slack_id = user2_slack_id |
There was a problem hiding this comment.
How would 3 people models be represented in the database? Or is it intended that 3 people pairings are a one-off?
| # If we have an odd number of people that is not 1 | ||
| # We put the odd person out in one of the groups | ||
| # So we might have a group of 3 |
There was a problem hiding this comment.
| # If we have an odd number of people that is not 1 | |
| # We put the odd person out in one of the groups | |
| # So we might have a group of 3 | |
| # If we have an odd number of people that is not 1, | |
| # or if there is 1 person left unpaired: | |
| # We put the odd person out in one of the groups | |
| # So we might have a group of 3 |
| table_name = self.CONST.get_table_name(Model) | ||
| table = self.ddb.Table(table_name) | ||
| table.delete() | ||
| table.wait_until_not_exists() | ||
| self.__create_table(table_name) |
There was a problem hiding this comment.
May want to comment that this is the best way to remove all items from a table, because it makes fewer calls.
|
|
||
| :param users: the list of users to add to the private chat | ||
|
|
||
| :raise SlackAPIError if the slack API returned error openning the chat |
There was a problem hiding this comment.
| :raise SlackAPIError if the slack API returned error openning the chat | |
| :raise SlackAPIError if the slack API returned error opening the chat |
| AWS_SECRET_KEY='itsa secret' | ||
| AWS_USERS_TABLE='users' | ||
| AWS_TEAMS_TABLE='teams' | ||
| AWS_PAIRINGS_TABLE='pairings' |
There was a problem hiding this comment.
May want to add the optional config options for others to see how it works.
|
|
||
| def test_valid_pairing(self): | ||
| """Test the pairing static method is_valid().""" | ||
| self.assertTrue(Pairing.is_valid(self.p0)) |
There was a problem hiding this comment.
Don't forget to test the invalid cases as well!
| assert 'user1' in args | ||
| assert 'user2' in args | ||
| assert len(args) == 2 |
There was a problem hiding this comment.
| assert 'user1' in args | |
| assert 'user2' in args | |
| assert len(args) == 2 | |
| self.assertIn('user1', args) | |
| self.assertIn('user2', args) | |
| self.assertEqual(len(args), 2) |
There are others.
|
Nothing that this closes https://github.com/ubclaunchpad/ideas/issues/8 as well |


fixes #514 , closes https://github.com/ubclaunchpad/ideas/issues/8
Details
Creates basic donut style matching for Rocket.
What implemented so far:
TODOs before this is ready:
Add TTL to entries in the Pairings tableI can file a follow up for this, we can live without it for nowWhere I am currently:
Contemplating if I should add a table for the pairings or if it should be a part of theUsermodel, leaning towards the latter with possibly opening a ticket for the former beyond this pr.Went with creating a new table 😄 Now working on adding the TTL and making sure edge cases don't explode on us
I'll be updating the above as I go.