Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crazyhouse #319

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
786ef3d
Restructure registration form
colwem Feb 20, 2019
9858a37
make git ignore .jar files
colwem Feb 20, 2019
a895ec6
Add crazyhouse to rating type options
colwem Feb 20, 2019
f11d220
Add migrations for previous commit
colwem Feb 20, 2019
bc2202b
Add create_registrations development utility
colwem Feb 20, 2019
325e7dc
Fix error message gen for round transition
colwem Feb 20, 2019
4d4169d
fix some formating
colwem Mar 5, 2019
bac47ef
Speed up create registrations script
colwem Mar 5, 2019
d9da292
Extract hard coded references to chesster's name
colwem Mar 5, 2019
c7cb9f0
Fix some formating
colwem Mar 5, 2019
f542205
DRY up code to detect changes in models
colwem Mar 19, 2019
f6e2145
Fix error caused when a team has no members and hence an average rati…
colwem Mar 19, 2019
a27f879
Add Board model for customizing board time_control and game count
colwem Mar 19, 2019
b6d8118
Update pairinggen to create correct number of pairings for each board
colwem Mar 19, 2019
85a2971
Update api to work with chesster changes
colwem Mar 20, 2019
c5da196
Add login creds stuff to vagrant4545 configuration
colwem Mar 20, 2019
80c3bd2
Fix error caused by someone not having ratings
colwem Mar 20, 2019
14fba8e
Fix team members being displayed on the wrong team in pairings
colwem Mar 20, 2019
e0da52f
Fix result inversion problem
colwem Mar 23, 2019
6d2a8ed
Fix TeamPairing score calculation
colwem Mar 24, 2019
d41969e
Make things get pairing details from pairing and not league
colwem Apr 2, 2019
d29206c
wip
colwem Apr 16, 2019
4c9634d
fix notifications
colwem Apr 17, 2019
842bc67
Fix the reversed team player pairings
colwem Apr 17, 2019
2a4093b
Change registration form to allow for options zhteam needs
colwem Apr 19, 2019
56098b5
Remove non-editable fields from registration form
colwem Apr 19, 2019
499eb52
Use StaticFileHandler in debug mode so gunicorn serves static files
colwem Apr 20, 2019
f4fcf73
Fix ical problem
colwem May 15, 2019
a36a020
Change registration so that non-changable stuff is non-changable
colwem May 15, 2019
8f57448
Temporary changes to make create_team_channel work
colwem May 20, 2019
80a39dc
Clean up some code in the admin file
colwem May 22, 2019
91569b7
Update alternates manager to handle multiple games per board
colwem May 22, 2019
9255f1c
Update config for vagrant
colwem May 22, 2019
efbe74c
fix admin page for Board
colwem May 23, 2019
d5893fe
Fix pairing notifications
colwem May 23, 2019
424220d
Add captains to multi messages for pairings
colwem May 23, 2019
ffe0049
Fix notifications, add tests, add captains to mpim
colwem May 29, 2019
0af0daf
Fix some bugs
colwem May 31, 2019
9fa65b8
Add celery command to manage.py so that it can be reloaded during dev
colwem May 31, 2019
d78becb
Fix unresponsive to work with multiple games per pairing
colwem May 31, 2019
c615167
update tests
colwem Jun 12, 2019
9ec3e89
Fix mod request forfeit only forfeits one game
colwem Jun 12, 2019
ddfb21e
Add local dev settings for colwem-tower
colwem Jul 8, 2019
69466e0
Add generate_player_pairings action to TeamPairingAdmin
colwem Jul 8, 2019
3372274
fix previous commit
colwem Jul 9, 2019
768ef7e
fix error caused by PlayerPairing object having no access to round
colwem Jul 13, 2019
2d6a4ec
Fix previous members list in team_profile page
colwem Jul 14, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update tests
  • Loading branch information
colwem committed Jun 12, 2019
commit c6151671b0e8ef0be05d8c4ec2749e8f6f0af8f8
25 changes: 24 additions & 1 deletion heltour/celery.py
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
import os

from celery import Celery
from celery.signals import after_setup_logger

# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'heltour.settings')
@@ -11,7 +12,29 @@

app = Celery('heltour')

app.config_from_object('django.conf:settings')

@after_setup_logger.connect
def setup_loggers(logger, *args, **kwargs):
"""
Handler names is a list of handlers from your settings.py you want to
attach to this
"""

handler_names = ['mail_admins']

import logging.config
from django.conf import settings
logging.config.dictConfig(settings.LOGGING)

logger = kwargs.get('logger')

handlers = [x for x in logging.root.handlers if x.name in handler_names]
for handler in handlers:
logger.addHandler(handler)
logger.setLevel(handler.level)
logger.propagate = False

# Using a string here means the worker will not have to
# pickle the object when using Windows.
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
2 changes: 1 addition & 1 deletion heltour/live_settings.py
Original file line number Diff line number Diff line change
@@ -210,7 +210,7 @@
},
'celery_is_up': {
'task': 'heltour.tournament.tasks.celery_is_up',
'schedule': timedelta(minutes=1),
'schedule': timedelta(minutes=5),
'args': ()
},
}
14 changes: 11 additions & 3 deletions heltour/tournament/notify.py
Original file line number Diff line number Diff line change
@@ -843,6 +843,7 @@ def notify_unresponsive(round_, player, punishment, allow_continue, pairing, **k
team = tpp.white_team()
else:
team = tpp.black_team()

message = ('{captains}<@{player}> appears to be unresponsive on board'
'{board} of "{team}" in round {round}.'.format(
captains=_captains_ping(team, round_),
@@ -876,9 +877,16 @@ def notify_opponent_unresponsive(round_, player, **kwargs):
def notify_noshow(round_, player, opponent, **kwargs):
season = round_.season
league = season.league
claim_url = abs_url(reverse('by_league:by_season:modrequest', args=[league.tag, season.tag, 'claim_win_noshow']))
message = 'Notice: It appears your opponent, <@%s>, has not shown up for your scheduled game time in %s. ' % (_slack_user(opponent), league.name) \
+ 'To claim a win by forfeit, <%s|click here>.' % claim_url
claim_url = abs_url(reverse(
'by_league:by_season:modrequest',
args=[league.tag, season.tag, 'claim_win_noshow']))
message = ('Notice: It appears your opponent, <@{opponent}>, has not shown '
'up for your scheduled game time in {league}. To claim a win by '
'forfeit, <{claim_url}|click here>.'
.format(
opponent=_slack_user(opponent),
league=league.name,
claim_url=claim_url))
_message_user(league, _slack_user(player), message)

@receiver(signals.notify_noshow_claim, dispatch_uid='heltour.tournament.notify')
9 changes: 9 additions & 0 deletions heltour/tournament/tests/test_notify.py
Original file line number Diff line number Diff line change
@@ -69,6 +69,15 @@ def make_player_pairing(tp, t1, t2):
white=t1.board(1),
black=t2.board(1))

def common_objects():
league = m.League.objects.first()
r = m.Round.objects.get(number=1)
t1, t2 = m.Team.objects.get(number=1), m.Team.objects.get(number=2)
tp = make_team_pairing(t1, t2)
tpp = make_player_pairing(tp, t1, t2)
white, black = tpp.white, tpp.black
return league, r, t1, t2, tp, tpp, white, black

class NotifyAlternateAndOpponentTestCase(TestCase):
def setUp(self):
create_team_league()