hockey-blast-common-lib 0.1.6__py3-none-any.whl → 0.1.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hockey_blast_common_lib/db_connection.py +0 -21
- hockey_blast_common_lib/models.py +0 -527
- hockey_blast_common_lib/stats_models.py +532 -0
- hockey_blast_common_lib/wsgi.py +16 -0
- {hockey_blast_common_lib-0.1.6.dist-info → hockey_blast_common_lib-0.1.7.dist-info}/METADATA +1 -1
- hockey_blast_common_lib-0.1.7.dist-info/RECORD +10 -0
- hockey_blast_common_lib-0.1.6.dist-info/RECORD +0 -8
- {hockey_blast_common_lib-0.1.6.dist-info → hockey_blast_common_lib-0.1.7.dist-info}/WHEEL +0 -0
- {hockey_blast_common_lib-0.1.6.dist-info → hockey_blast_common_lib-0.1.7.dist-info}/top_level.txt +0 -0
@@ -11,27 +11,6 @@ DB_PARAMS = {
|
|
11
11
|
"host": "localhost",
|
12
12
|
"port": 5432
|
13
13
|
},
|
14
|
-
"sharksice": {
|
15
|
-
"dbname": "hockey_blast",
|
16
|
-
"user": "read_only_user",
|
17
|
-
"password": "hockey-blast",
|
18
|
-
"host": "localhost",
|
19
|
-
"port": 5432
|
20
|
-
},
|
21
|
-
"caha": {
|
22
|
-
"dbname": "hockey_blast",
|
23
|
-
"user": "read_only_user",
|
24
|
-
"password": "hockey-blast",
|
25
|
-
"host": "localhost",
|
26
|
-
"port": 5432
|
27
|
-
},
|
28
|
-
"tvice": {
|
29
|
-
"dbname": "hockey_blast",
|
30
|
-
"user": "read_only_user",
|
31
|
-
"password": "hockey-blast",
|
32
|
-
"host": "localhost",
|
33
|
-
"port": 5432
|
34
|
-
},
|
35
14
|
}
|
36
15
|
|
37
16
|
def get_db_params(config_name):
|
@@ -1,5 +1,4 @@
|
|
1
1
|
from flask_sqlalchemy import SQLAlchemy
|
2
|
-
from sqlalchemy.ext.declarative import declared_attr
|
3
2
|
|
4
3
|
db = SQLAlchemy()
|
5
4
|
|
@@ -339,532 +338,6 @@ class TeamInTTS(db.Model):
|
|
339
338
|
)
|
340
339
|
|
341
340
|
|
342
|
-
# CLASSES FOR STATS ARE BELOW THIS LINE
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
class BaseStatsHuman(db.Model):
|
361
|
-
__abstract__ = True
|
362
|
-
id = db.Column(db.Integer, primary_key=True)
|
363
|
-
human_id = db.Column(db.Integer, db.ForeignKey('humans.id'), nullable=False)
|
364
|
-
games_total = db.Column(db.Integer, default=0)
|
365
|
-
games_total_rank = db.Column(db.Integer, default=0)
|
366
|
-
games_skater = db.Column(db.Integer, default=0)
|
367
|
-
games_skater_rank = db.Column(db.Integer, default=0)
|
368
|
-
games_referee = db.Column(db.Integer, default=0)
|
369
|
-
games_referee_rank = db.Column(db.Integer, default=0)
|
370
|
-
games_scorekeeper = db.Column(db.Integer, default=0)
|
371
|
-
games_scorekeeper_rank = db.Column(db.Integer, default=0)
|
372
|
-
games_goalie = db.Column(db.Integer, default=0)
|
373
|
-
games_goalie_rank = db.Column(db.Integer, default=0)
|
374
|
-
total_in_rank = db.Column(db.Integer, default=0)
|
375
|
-
first_game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
|
376
|
-
last_game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
|
377
|
-
|
378
|
-
@declared_attr
|
379
|
-
def __table_args__(cls):
|
380
|
-
return (
|
381
|
-
db.UniqueConstraint('human_id', cls.aggregation_id, name=f'_human_{cls.aggregation_type}_stats_uc1'),
|
382
|
-
db.Index(f'idx_{cls.aggregation_type}_games_total1', cls.aggregation_id, 'games_total'),
|
383
|
-
db.Index(f'idx_{cls.aggregation_type}_games_skater1', cls.aggregation_id, 'games_skater'),
|
384
|
-
db.Index(f'idx_{cls.aggregation_type}_games_referee1', cls.aggregation_id, 'games_referee'),
|
385
|
-
db.Index(f'idx_{cls.aggregation_type}_games_scorekeeper1', cls.aggregation_id, 'games_scorekeeper'),
|
386
|
-
db.Index(f'idx_{cls.aggregation_type}_games_goalie1', cls.aggregation_id, 'games_goalie')
|
387
|
-
)
|
388
|
-
|
389
|
-
class BaseStatsSkater(db.Model):
|
390
|
-
__abstract__ = True
|
391
|
-
id = db.Column(db.Integer, primary_key=True)
|
392
|
-
human_id = db.Column(db.Integer, db.ForeignKey('humans.id'), nullable=False)
|
393
|
-
games_played = db.Column(db.Integer, default=0)
|
394
|
-
games_played_rank = db.Column(db.Integer, default=0)
|
395
|
-
goals = db.Column(db.Integer, default=0)
|
396
|
-
goals_rank = db.Column(db.Integer, default=0)
|
397
|
-
assists = db.Column(db.Integer, default=0)
|
398
|
-
assists_rank = db.Column(db.Integer, default=0)
|
399
|
-
points = db.Column(db.Integer, default=0)
|
400
|
-
points_rank = db.Column(db.Integer, default=0)
|
401
|
-
penalties = db.Column(db.Integer, default=0)
|
402
|
-
penalties_rank = db.Column(db.Integer, default=0)
|
403
|
-
goals_per_game = db.Column(db.Float, default=0.0)
|
404
|
-
goals_per_game_rank = db.Column(db.Integer, default=0)
|
405
|
-
points_per_game = db.Column(db.Float, default=0.0)
|
406
|
-
points_per_game_rank = db.Column(db.Integer, default=0)
|
407
|
-
assists_per_game = db.Column(db.Float, default=0.0)
|
408
|
-
assists_per_game_rank = db.Column(db.Integer, default=0)
|
409
|
-
penalties_per_game = db.Column(db.Float, default=0.0)
|
410
|
-
penalties_per_game_rank = db.Column(db.Integer, default=0)
|
411
|
-
total_in_rank = db.Column(db.Integer, default=0)
|
412
|
-
first_game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
|
413
|
-
last_game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
|
414
|
-
|
415
|
-
@declared_attr
|
416
|
-
def __table_args__(cls):
|
417
|
-
return (
|
418
|
-
db.UniqueConstraint('human_id', cls.aggregation_id, name=f'_human_{cls.aggregation_type}_uc_skater1'),
|
419
|
-
db.Index(f'idx_{cls.aggregation_type}_goals_per_game3', cls.aggregation_id, 'goals_per_game'),
|
420
|
-
db.Index(f'idx_{cls.aggregation_type}_points_per_game3', cls.aggregation_id, 'points_per_game'),
|
421
|
-
db.Index(f'idx_{cls.aggregation_type}_assists_per_game3', cls.aggregation_id, 'assists_per_game'),
|
422
|
-
db.Index(f'idx_{cls.aggregation_type}_penalties_per_game3', cls.aggregation_id, 'penalties_per_game'),
|
423
|
-
db.Index(f'idx_{cls.aggregation_type}_games_played3', cls.aggregation_id, 'games_played')
|
424
|
-
)
|
425
|
-
|
426
|
-
class BaseStatsGoalie(db.Model):
|
427
|
-
__abstract__ = True
|
428
|
-
id = db.Column(db.Integer, primary_key=True)
|
429
|
-
human_id = db.Column(db.Integer, db.ForeignKey('humans.id'), nullable=False)
|
430
|
-
games_played = db.Column(db.Integer, default=0)
|
431
|
-
games_played_rank = db.Column(db.Integer, default=0)
|
432
|
-
goals_allowed = db.Column(db.Integer, default=0)
|
433
|
-
goals_allowed_rank = db.Column(db.Integer, default=0)
|
434
|
-
goals_allowed_per_game = db.Column(db.Float, default=0.0)
|
435
|
-
goals_allowed_per_game_rank = db.Column(db.Integer, default=0)
|
436
|
-
shots_faced = db.Column(db.Integer, default=0)
|
437
|
-
shots_faced_rank = db.Column(db.Integer, default=0)
|
438
|
-
save_percentage = db.Column(db.Float, default=0.0)
|
439
|
-
save_percentage_rank = db.Column(db.Integer, default=0)
|
440
|
-
total_in_rank = db.Column(db.Integer, default=0)
|
441
|
-
first_game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
|
442
|
-
last_game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
|
443
|
-
|
444
|
-
@declared_attr
|
445
|
-
def __table_args__(cls):
|
446
|
-
return (
|
447
|
-
db.UniqueConstraint('human_id', cls.aggregation_id, name=f'_human_{cls.aggregation_type}_uc_goalie1'),
|
448
|
-
db.Index(f'idx_{cls.aggregation_type}_goals_allowed_per_game1', cls.aggregation_id, 'goals_allowed_per_game'),
|
449
|
-
db.Index(f'idx_{cls.aggregation_type}_save_percentage1', cls.aggregation_id, 'save_percentage'),
|
450
|
-
db.Index(f'idx_{cls.aggregation_type}_shots_faced1', cls.aggregation_id, 'shots_faced'),
|
451
|
-
db.Index(f'idx_{cls.aggregation_type}_games_played_goalie1', cls.aggregation_id, 'games_played'),
|
452
|
-
db.Index(f'idx_{cls.aggregation_type}_goals_allowed1', cls.aggregation_id, 'goals_allowed')
|
453
|
-
)
|
454
|
-
|
455
|
-
class BaseStatsReferee(db.Model):
|
456
|
-
__abstract__ = True
|
457
|
-
id = db.Column(db.Integer, primary_key=True)
|
458
|
-
human_id = db.Column(db.Integer, db.ForeignKey('humans.id'), nullable=False)
|
459
|
-
games_reffed = db.Column(db.Integer, default=0)
|
460
|
-
games_reffed_rank = db.Column(db.Integer, default=0)
|
461
|
-
penalties_given = db.Column(db.Integer, default=0)
|
462
|
-
penalties_given_rank = db.Column(db.Integer, default=0)
|
463
|
-
penalties_per_game = db.Column(db.Float, default=0.0)
|
464
|
-
penalties_per_game_rank = db.Column(db.Integer, default=0)
|
465
|
-
gm_given = db.Column(db.Integer, default=0)
|
466
|
-
gm_given_rank = db.Column(db.Integer, default=0)
|
467
|
-
gm_per_game = db.Column(db.Float, default=0.0)
|
468
|
-
gm_per_game_rank = db.Column(db.Integer, default=0)
|
469
|
-
total_in_rank = db.Column(db.Integer, default=0)
|
470
|
-
first_game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
|
471
|
-
last_game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
|
472
|
-
|
473
|
-
@declared_attr
|
474
|
-
def __table_args__(cls):
|
475
|
-
return (
|
476
|
-
db.UniqueConstraint('human_id', cls.aggregation_id, name=f'_human_{cls.aggregation_type}_uc_referee1'),
|
477
|
-
db.Index(f'idx_{cls.aggregation_type}_games_reffed1', cls.aggregation_id, 'games_reffed'),
|
478
|
-
db.Index(f'idx_{cls.aggregation_type}_penalties_given1', cls.aggregation_id, 'penalties_given'),
|
479
|
-
db.Index(f'idx_{cls.aggregation_type}_penalties_per_game1', cls.aggregation_id, 'penalties_per_game'),
|
480
|
-
db.Index(f'idx_{cls.aggregation_type}_gm_given1', cls.aggregation_id, 'gm_given'),
|
481
|
-
db.Index(f'idx_{cls.aggregation_type}_gm_per_game1', cls.aggregation_id, 'gm_per_game')
|
482
|
-
)
|
483
|
-
|
484
|
-
class BaseStatsScorekeeper(db.Model):
|
485
|
-
__abstract__ = True
|
486
|
-
id = db.Column(db.Integer, primary_key=True)
|
487
|
-
human_id = db.Column(db.Integer, db.ForeignKey('humans.id'), nullable=False)
|
488
|
-
games_recorded = db.Column(db.Integer, default=0)
|
489
|
-
games_recorded_rank = db.Column(db.Integer, default=0)
|
490
|
-
sog_given = db.Column(db.Integer, default=0)
|
491
|
-
sog_given_rank = db.Column(db.Integer, default=0)
|
492
|
-
sog_per_game = db.Column(db.Float, default=0.0)
|
493
|
-
sog_per_game_rank = db.Column(db.Integer, default=0)
|
494
|
-
total_in_rank = db.Column(db.Integer, default=0)
|
495
|
-
first_game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
|
496
|
-
last_game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
|
497
|
-
|
498
|
-
@declared_attr
|
499
|
-
def __table_args__(cls):
|
500
|
-
return (
|
501
|
-
db.UniqueConstraint('human_id', cls.aggregation_id, name=f'_human_{cls.aggregation_type}_uc_scorekeeper1'),
|
502
|
-
db.Index(f'idx_{cls.aggregation_type}_games_recorded1', cls.aggregation_id, 'games_recorded'),
|
503
|
-
db.Index(f'idx_{cls.aggregation_type}_sog_given1', cls.aggregation_id, 'sog_given'),
|
504
|
-
db.Index(f'idx_{cls.aggregation_type}_sog_per_game1', cls.aggregation_id, 'sog_per_game')
|
505
|
-
)
|
506
|
-
|
507
|
-
class OrgStatsHuman(BaseStatsHuman):
|
508
|
-
__tablename__ = 'org_stats_human'
|
509
|
-
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
510
|
-
|
511
|
-
@declared_attr
|
512
|
-
def aggregation_id(cls):
|
513
|
-
return cls.org_id
|
514
|
-
|
515
|
-
@declared_attr
|
516
|
-
def aggregation_type(cls):
|
517
|
-
return 'org'
|
518
|
-
|
519
|
-
class DivisionStatsHuman(BaseStatsHuman):
|
520
|
-
__tablename__ = 'division_stats_human'
|
521
|
-
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
522
|
-
|
523
|
-
@declared_attr
|
524
|
-
def aggregation_id(cls):
|
525
|
-
return cls.division_id
|
526
|
-
|
527
|
-
@declared_attr
|
528
|
-
def aggregation_type(cls):
|
529
|
-
return 'division'
|
530
|
-
|
531
|
-
class OrgStatsSkater(BaseStatsSkater):
|
532
|
-
__tablename__ = 'org_stats_skater'
|
533
|
-
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
534
|
-
|
535
|
-
@declared_attr
|
536
|
-
def aggregation_id(cls):
|
537
|
-
return cls.org_id
|
538
|
-
|
539
|
-
@declared_attr
|
540
|
-
def aggregation_type(cls):
|
541
|
-
return 'org'
|
542
|
-
|
543
|
-
class DivisionStatsSkater(BaseStatsSkater):
|
544
|
-
__tablename__ = 'division_stats_skater'
|
545
|
-
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
546
|
-
|
547
|
-
@declared_attr
|
548
|
-
def aggregation_id(cls):
|
549
|
-
return cls.division_id
|
550
|
-
|
551
|
-
@declared_attr
|
552
|
-
def aggregation_type(cls):
|
553
|
-
return 'division'
|
554
|
-
|
555
|
-
class OrgStatsGoalie(BaseStatsGoalie):
|
556
|
-
__tablename__ = 'org_stats_goalie'
|
557
|
-
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
558
|
-
|
559
|
-
@declared_attr
|
560
|
-
def aggregation_id(cls):
|
561
|
-
return cls.org_id
|
562
|
-
|
563
|
-
@declared_attr
|
564
|
-
def aggregation_type(cls):
|
565
|
-
return 'org'
|
566
|
-
|
567
|
-
class DivisionStatsGoalie(BaseStatsGoalie):
|
568
|
-
__tablename__ = 'division_stats_goalie'
|
569
|
-
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
570
|
-
|
571
|
-
@declared_attr
|
572
|
-
def aggregation_id(cls):
|
573
|
-
return cls.division_id
|
574
|
-
|
575
|
-
@declared_attr
|
576
|
-
def aggregation_type(cls):
|
577
|
-
return 'division'
|
578
|
-
|
579
|
-
|
580
|
-
class OrgStatsReferee(BaseStatsReferee):
|
581
|
-
__tablename__ = 'org_stats_referee'
|
582
|
-
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
583
|
-
|
584
|
-
@declared_attr
|
585
|
-
def aggregation_id(cls):
|
586
|
-
return cls.org_id
|
587
|
-
|
588
|
-
@declared_attr
|
589
|
-
def aggregation_type(cls):
|
590
|
-
return 'org'
|
591
|
-
|
592
|
-
class DivisionStatsReferee(BaseStatsReferee):
|
593
|
-
__tablename__ = 'division_stats_referee'
|
594
|
-
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
595
|
-
|
596
|
-
@declared_attr
|
597
|
-
def aggregation_id(cls):
|
598
|
-
return cls.division_id
|
599
|
-
|
600
|
-
@declared_attr
|
601
|
-
def aggregation_type(cls):
|
602
|
-
return 'division'
|
603
|
-
|
604
|
-
|
605
|
-
class OrgStatsScorekeeper(BaseStatsScorekeeper):
|
606
|
-
__tablename__ = 'org_stats_scorekeeper'
|
607
|
-
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
608
|
-
|
609
|
-
@declared_attr
|
610
|
-
def aggregation_id(cls):
|
611
|
-
return cls.org_id
|
612
|
-
|
613
|
-
@declared_attr
|
614
|
-
def aggregation_type(cls):
|
615
|
-
return 'org'
|
616
|
-
|
617
|
-
class DivisionStatsScorekeeper(BaseStatsScorekeeper):
|
618
|
-
__tablename__ = 'division_stats_scorekeeper'
|
619
|
-
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
620
|
-
|
621
|
-
@declared_attr
|
622
|
-
def aggregation_id(cls):
|
623
|
-
return cls.division_id
|
624
|
-
|
625
|
-
@declared_attr
|
626
|
-
def aggregation_type(cls):
|
627
|
-
return 'division'
|
628
|
-
|
629
|
-
class OrgStatsDailyHuman(BaseStatsHuman):
|
630
|
-
__tablename__ = 'org_stats_daily_human'
|
631
|
-
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
632
|
-
|
633
|
-
@declared_attr
|
634
|
-
def aggregation_id(cls):
|
635
|
-
return cls.org_id
|
636
|
-
|
637
|
-
@declared_attr
|
638
|
-
def aggregation_type(cls):
|
639
|
-
return 'org_daily'
|
640
|
-
|
641
|
-
class OrgStatsWeeklyHuman(BaseStatsHuman):
|
642
|
-
__tablename__ = 'org_stats_weekly_human'
|
643
|
-
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
644
|
-
|
645
|
-
@declared_attr
|
646
|
-
def aggregation_id(cls):
|
647
|
-
return cls.org_id
|
648
|
-
|
649
|
-
@declared_attr
|
650
|
-
def aggregation_type(cls):
|
651
|
-
return 'org_weekly'
|
652
|
-
|
653
|
-
class DivisionStatsDailyHuman(BaseStatsHuman):
|
654
|
-
__tablename__ = 'division_stats_daily_human'
|
655
|
-
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
656
|
-
|
657
|
-
@declared_attr
|
658
|
-
def aggregation_id(cls):
|
659
|
-
return cls.division_id
|
660
|
-
|
661
|
-
@declared_attr
|
662
|
-
def aggregation_type(cls):
|
663
|
-
return 'division_daily'
|
664
|
-
|
665
|
-
class DivisionStatsWeeklyHuman(BaseStatsHuman):
|
666
|
-
__tablename__ = 'division_stats_weekly_human'
|
667
|
-
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
668
|
-
|
669
|
-
@declared_attr
|
670
|
-
def aggregation_id(cls):
|
671
|
-
return cls.division_id
|
672
|
-
|
673
|
-
@declared_attr
|
674
|
-
def aggregation_type(cls):
|
675
|
-
return 'division_weekly'
|
676
|
-
|
677
|
-
class OrgStatsDailySkater(BaseStatsSkater):
|
678
|
-
__tablename__ = 'org_stats_daily_skater'
|
679
|
-
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
680
|
-
|
681
|
-
@declared_attr
|
682
|
-
def aggregation_id(cls):
|
683
|
-
return cls.org_id
|
684
|
-
|
685
|
-
@declared_attr
|
686
|
-
def aggregation_type(cls):
|
687
|
-
return 'org_daily'
|
688
|
-
|
689
|
-
class OrgStatsWeeklySkater(BaseStatsSkater):
|
690
|
-
__tablename__ = 'org_stats_weekly_skater'
|
691
|
-
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
692
|
-
|
693
|
-
@declared_attr
|
694
|
-
def aggregation_id(cls):
|
695
|
-
return cls.org_id
|
696
|
-
|
697
|
-
@declared_attr
|
698
|
-
def aggregation_type(cls):
|
699
|
-
return 'org_weekly'
|
700
|
-
|
701
|
-
class DivisionStatsDailySkater(BaseStatsSkater):
|
702
|
-
__tablename__ = 'division_stats_daily_skater'
|
703
|
-
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
704
|
-
|
705
|
-
@declared_attr
|
706
|
-
def aggregation_id(cls):
|
707
|
-
return cls.division_id
|
708
|
-
|
709
|
-
@declared_attr
|
710
|
-
def aggregation_type(cls):
|
711
|
-
return 'division_daily'
|
712
|
-
|
713
|
-
class DivisionStatsWeeklySkater(BaseStatsSkater):
|
714
|
-
__tablename__ = 'division_stats_weekly_skater'
|
715
|
-
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
716
|
-
|
717
|
-
@declared_attr
|
718
|
-
def aggregation_id(cls):
|
719
|
-
return cls.division_id
|
720
|
-
|
721
|
-
@declared_attr
|
722
|
-
def aggregation_type(cls):
|
723
|
-
return 'division_weekly'
|
724
|
-
|
725
|
-
class OrgStatsDailyGoalie(BaseStatsGoalie):
|
726
|
-
__tablename__ = 'org_stats_daily_goalie'
|
727
|
-
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
728
|
-
|
729
|
-
@declared_attr
|
730
|
-
def aggregation_id(cls):
|
731
|
-
return cls.org_id
|
732
|
-
|
733
|
-
@declared_attr
|
734
|
-
def aggregation_type(cls):
|
735
|
-
return 'org_daily'
|
736
|
-
|
737
|
-
class OrgStatsWeeklyGoalie(BaseStatsGoalie):
|
738
|
-
__tablename__ = 'org_stats_weekly_goalie'
|
739
|
-
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
740
|
-
|
741
|
-
@declared_attr
|
742
|
-
def aggregation_id(cls):
|
743
|
-
return cls.org_id
|
744
|
-
|
745
|
-
@declared_attr
|
746
|
-
def aggregation_type(cls):
|
747
|
-
return 'org_weekly'
|
748
|
-
|
749
|
-
class DivisionStatsDailyGoalie(BaseStatsGoalie):
|
750
|
-
__tablename__ = 'division_stats_daily_goalie'
|
751
|
-
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
752
|
-
|
753
|
-
@declared_attr
|
754
|
-
def aggregation_id(cls):
|
755
|
-
return cls.division_id
|
756
|
-
|
757
|
-
@declared_attr
|
758
|
-
def aggregation_type(cls):
|
759
|
-
return 'division_daily'
|
760
|
-
|
761
|
-
class DivisionStatsWeeklyGoalie(BaseStatsGoalie):
|
762
|
-
__tablename__ = 'division_stats_weekly_goalie'
|
763
|
-
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
764
|
-
|
765
|
-
@declared_attr
|
766
|
-
def aggregation_id(cls):
|
767
|
-
return cls.division_id
|
768
|
-
|
769
|
-
@declared_attr
|
770
|
-
def aggregation_type(cls):
|
771
|
-
return 'division_weekly'
|
772
|
-
|
773
|
-
class OrgStatsDailyReferee(BaseStatsReferee):
|
774
|
-
__tablename__ = 'org_stats_daily_referee'
|
775
|
-
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
776
|
-
|
777
|
-
@declared_attr
|
778
|
-
def aggregation_id(cls):
|
779
|
-
return cls.org_id
|
780
|
-
|
781
|
-
@declared_attr
|
782
|
-
def aggregation_type(cls):
|
783
|
-
return 'org_daily'
|
784
|
-
|
785
|
-
class OrgStatsWeeklyReferee(BaseStatsReferee):
|
786
|
-
__tablename__ = 'org_stats_weekly_referee'
|
787
|
-
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
788
|
-
|
789
|
-
@declared_attr
|
790
|
-
def aggregation_id(cls):
|
791
|
-
return cls.org_id
|
792
|
-
|
793
|
-
@declared_attr
|
794
|
-
def aggregation_type(cls):
|
795
|
-
return 'org_weekly'
|
796
|
-
|
797
|
-
class DivisionStatsDailyReferee(BaseStatsReferee):
|
798
|
-
__tablename__ = 'division_stats_daily_referee'
|
799
|
-
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
800
|
-
|
801
|
-
@declared_attr
|
802
|
-
def aggregation_id(cls):
|
803
|
-
return cls.division_id
|
804
|
-
|
805
|
-
@declared_attr
|
806
|
-
def aggregation_type(cls):
|
807
|
-
return 'division_daily'
|
808
|
-
|
809
|
-
class DivisionStatsWeeklyReferee(BaseStatsReferee):
|
810
|
-
__tablename__ = 'division_stats_weekly_referee'
|
811
|
-
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
812
|
-
|
813
|
-
@declared_attr
|
814
|
-
def aggregation_id(cls):
|
815
|
-
return cls.division_id
|
816
|
-
|
817
|
-
@declared_attr
|
818
|
-
def aggregation_type(cls):
|
819
|
-
return 'division_weekly'
|
820
|
-
|
821
|
-
class OrgStatsDailyScorekeeper(BaseStatsScorekeeper):
|
822
|
-
__tablename__ = 'org_stats_daily_scorekeeper'
|
823
|
-
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
824
|
-
|
825
|
-
@declared_attr
|
826
|
-
def aggregation_id(cls):
|
827
|
-
return cls.org_id
|
828
|
-
|
829
|
-
@declared_attr
|
830
|
-
def aggregation_type(cls):
|
831
|
-
return 'org_daily'
|
832
|
-
|
833
|
-
class OrgStatsWeeklyScorekeeper(BaseStatsScorekeeper):
|
834
|
-
__tablename__ = 'org_stats_weekly_scorekeeper'
|
835
|
-
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
836
|
-
|
837
|
-
@declared_attr
|
838
|
-
def aggregation_id(cls):
|
839
|
-
return cls.org_id
|
840
|
-
|
841
|
-
@declared_attr
|
842
|
-
def aggregation_type(cls):
|
843
|
-
return 'org_weekly'
|
844
|
-
|
845
|
-
class DivisionStatsDailyScorekeeper(BaseStatsScorekeeper):
|
846
|
-
__tablename__ = 'division_stats_daily_scorekeeper'
|
847
|
-
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
848
|
-
|
849
|
-
@declared_attr
|
850
|
-
def aggregation_id(cls):
|
851
|
-
return cls.division_id
|
852
|
-
|
853
|
-
@declared_attr
|
854
|
-
def aggregation_type(cls):
|
855
|
-
return 'division_daily'
|
856
|
-
|
857
|
-
class DivisionStatsWeeklyScorekeeper(BaseStatsScorekeeper):
|
858
|
-
__tablename__ = 'division_stats_weekly_scorekeeper'
|
859
|
-
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
860
|
-
|
861
|
-
@declared_attr
|
862
|
-
def aggregation_id(cls):
|
863
|
-
return cls.division_id
|
864
|
-
|
865
|
-
@declared_attr
|
866
|
-
def aggregation_type(cls):
|
867
|
-
return 'division_weekly'
|
868
341
|
|
869
342
|
# # MANUAL AMENDS HAPPEN HERE :)
|
870
343
|
# from db_connection import create_session
|
@@ -0,0 +1,532 @@
|
|
1
|
+
from .models import db
|
2
|
+
from sqlalchemy.ext.declarative import declared_attr
|
3
|
+
|
4
|
+
class BaseStatsHuman(db.Model):
|
5
|
+
__abstract__ = True
|
6
|
+
id = db.Column(db.Integer, primary_key=True)
|
7
|
+
human_id = db.Column(db.Integer, db.ForeignKey('humans.id'), nullable=False)
|
8
|
+
games_total = db.Column(db.Integer, default=0)
|
9
|
+
games_total_rank = db.Column(db.Integer, default=0)
|
10
|
+
games_skater = db.Column(db.Integer, default=0)
|
11
|
+
games_skater_rank = db.Column(db.Integer, default=0)
|
12
|
+
games_referee = db.Column(db.Integer, default=0)
|
13
|
+
games_referee_rank = db.Column(db.Integer, default=0)
|
14
|
+
games_scorekeeper = db.Column(db.Integer, default=0)
|
15
|
+
games_scorekeeper_rank = db.Column(db.Integer, default=0)
|
16
|
+
games_goalie = db.Column(db.Integer, default=0)
|
17
|
+
games_goalie_rank = db.Column(db.Integer, default=0)
|
18
|
+
total_in_rank = db.Column(db.Integer, default=0)
|
19
|
+
first_game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
|
20
|
+
last_game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
|
21
|
+
|
22
|
+
@declared_attr
|
23
|
+
def __table_args__(cls):
|
24
|
+
return (
|
25
|
+
db.UniqueConstraint('human_id', cls.get_aggregation_column(), name=f'_human_{cls.aggregation_type}_stats_uc1'),
|
26
|
+
db.Index(f'idx_{cls.aggregation_type}_games_total1', cls.get_aggregation_column(), 'games_total'),
|
27
|
+
db.Index(f'idx_{cls.aggregation_type}_games_skater1', cls.get_aggregation_column(), 'games_skater'),
|
28
|
+
db.Index(f'idx_{cls.aggregation_type}_games_referee1', cls.get_aggregation_column(), 'games_referee'),
|
29
|
+
db.Index(f'idx_{cls.aggregation_type}_games_scorekeeper1', cls.get_aggregation_column(), 'games_scorekeeper'),
|
30
|
+
db.Index(f'idx_{cls.aggregation_type}_games_goalie1', cls.get_aggregation_column(), 'games_goalie')
|
31
|
+
)
|
32
|
+
|
33
|
+
@classmethod
|
34
|
+
def get_aggregation_column(cls):
|
35
|
+
raise NotImplementedError("Subclasses should implement this method to return the aggregation column name.")
|
36
|
+
|
37
|
+
|
38
|
+
class BaseStatsSkater(db.Model):
|
39
|
+
__abstract__ = True
|
40
|
+
id = db.Column(db.Integer, primary_key=True)
|
41
|
+
human_id = db.Column(db.Integer, db.ForeignKey('humans.id'), nullable=False)
|
42
|
+
games_played = db.Column(db.Integer, default=0)
|
43
|
+
games_played_rank = db.Column(db.Integer, default=0)
|
44
|
+
goals = db.Column(db.Integer, default=0)
|
45
|
+
goals_rank = db.Column(db.Integer, default=0)
|
46
|
+
assists = db.Column(db.Integer, default=0)
|
47
|
+
assists_rank = db.Column(db.Integer, default=0)
|
48
|
+
points = db.Column(db.Integer, default=0)
|
49
|
+
points_rank = db.Column(db.Integer, default=0)
|
50
|
+
penalties = db.Column(db.Integer, default=0)
|
51
|
+
penalties_rank = db.Column(db.Integer, default=0)
|
52
|
+
goals_per_game = db.Column(db.Float, default=0.0)
|
53
|
+
goals_per_game_rank = db.Column(db.Integer, default=0)
|
54
|
+
points_per_game = db.Column(db.Float, default=0.0)
|
55
|
+
points_per_game_rank = db.Column(db.Integer, default=0)
|
56
|
+
assists_per_game = db.Column(db.Float, default=0.0)
|
57
|
+
assists_per_game_rank = db.Column(db.Integer, default=0)
|
58
|
+
penalties_per_game = db.Column(db.Float, default=0.0)
|
59
|
+
penalties_per_game_rank = db.Column(db.Integer, default=0)
|
60
|
+
total_in_rank = db.Column(db.Integer, default=0)
|
61
|
+
first_game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
|
62
|
+
last_game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
|
63
|
+
|
64
|
+
@declared_attr
|
65
|
+
def __table_args__(cls):
|
66
|
+
return (
|
67
|
+
db.UniqueConstraint('human_id', cls.get_aggregation_column(), name=f'_human_{cls.aggregation_type}_uc_skater1'),
|
68
|
+
db.Index(f'idx_{cls.aggregation_type}_goals_per_game3', cls.get_aggregation_column(), 'goals_per_game'),
|
69
|
+
db.Index(f'idx_{cls.aggregation_type}_points_per_game3', cls.get_aggregation_column(), 'points_per_game'),
|
70
|
+
db.Index(f'idx_{cls.aggregation_type}_assists_per_game3', cls.get_aggregation_column(), 'assists_per_game'),
|
71
|
+
db.Index(f'idx_{cls.aggregation_type}_penalties_per_game3', cls.get_aggregation_column(), 'penalties_per_game'),
|
72
|
+
db.Index(f'idx_{cls.aggregation_type}_games_played3', cls.get_aggregation_column(), 'games_played')
|
73
|
+
)
|
74
|
+
|
75
|
+
@classmethod
|
76
|
+
def get_aggregation_column(cls):
|
77
|
+
raise NotImplementedError("Subclasses should implement this method to return the aggregation column name.")
|
78
|
+
|
79
|
+
class BaseStatsGoalie(db.Model):
|
80
|
+
__abstract__ = True
|
81
|
+
id = db.Column(db.Integer, primary_key=True)
|
82
|
+
human_id = db.Column(db.Integer, db.ForeignKey('humans.id'), nullable=False)
|
83
|
+
games_played = db.Column(db.Integer, default=0)
|
84
|
+
games_played_rank = db.Column(db.Integer, default=0)
|
85
|
+
goals_allowed = db.Column(db.Integer, default=0)
|
86
|
+
goals_allowed_rank = db.Column(db.Integer, default=0)
|
87
|
+
goals_allowed_per_game = db.Column(db.Float, default=0.0)
|
88
|
+
goals_allowed_per_game_rank = db.Column(db.Integer, default=0)
|
89
|
+
shots_faced = db.Column(db.Integer, default=0)
|
90
|
+
shots_faced_rank = db.Column(db.Integer, default=0)
|
91
|
+
save_percentage = db.Column(db.Float, default=0.0)
|
92
|
+
save_percentage_rank = db.Column(db.Integer, default=0)
|
93
|
+
total_in_rank = db.Column(db.Integer, default=0)
|
94
|
+
first_game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
|
95
|
+
last_game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
|
96
|
+
|
97
|
+
@declared_attr
|
98
|
+
def __table_args__(cls):
|
99
|
+
return (
|
100
|
+
db.UniqueConstraint('human_id', cls.get_aggregation_column(), name=f'_human_{cls.aggregation_type}_uc_goalie1'),
|
101
|
+
db.Index(f'idx_{cls.aggregation_type}_goals_allowed_per_game1', cls.get_aggregation_column(), 'goals_allowed_per_game'),
|
102
|
+
db.Index(f'idx_{cls.aggregation_type}_save_percentage1', cls.get_aggregation_column(), 'save_percentage'),
|
103
|
+
db.Index(f'idx_{cls.aggregation_type}_shots_faced1', cls.get_aggregation_column(), 'shots_faced'),
|
104
|
+
db.Index(f'idx_{cls.aggregation_type}_games_played_goalie1', cls.get_aggregation_column(), 'games_played'),
|
105
|
+
db.Index(f'idx_{cls.aggregation_type}_goals_allowed1', cls.get_aggregation_column(), 'goals_allowed')
|
106
|
+
)
|
107
|
+
|
108
|
+
@classmethod
|
109
|
+
def get_aggregation_column(cls):
|
110
|
+
raise NotImplementedError("Subclasses should implement this method to return the aggregation column name.")
|
111
|
+
|
112
|
+
class BaseStatsReferee(db.Model):
|
113
|
+
__abstract__ = True
|
114
|
+
id = db.Column(db.Integer, primary_key=True)
|
115
|
+
human_id = db.Column(db.Integer, db.ForeignKey('humans.id'), nullable=False)
|
116
|
+
games_reffed = db.Column(db.Integer, default=0)
|
117
|
+
games_reffed_rank = db.Column(db.Integer, default=0)
|
118
|
+
penalties_given = db.Column(db.Integer, default=0)
|
119
|
+
penalties_given_rank = db.Column(db.Integer, default=0)
|
120
|
+
penalties_per_game = db.Column(db.Float, default=0.0)
|
121
|
+
penalties_per_game_rank = db.Column(db.Integer, default=0)
|
122
|
+
gm_given = db.Column(db.Integer, default=0)
|
123
|
+
gm_given_rank = db.Column(db.Integer, default=0)
|
124
|
+
gm_per_game = db.Column(db.Float, default=0.0)
|
125
|
+
gm_per_game_rank = db.Column(db.Integer, default=0)
|
126
|
+
total_in_rank = db.Column(db.Integer, default=0)
|
127
|
+
first_game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
|
128
|
+
last_game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
|
129
|
+
|
130
|
+
@declared_attr
|
131
|
+
def __table_args__(cls):
|
132
|
+
return (
|
133
|
+
db.UniqueConstraint('human_id', cls.get_aggregation_column(), name=f'_human_{cls.aggregation_type}_uc_referee1'),
|
134
|
+
db.Index(f'idx_{cls.aggregation_type}_games_reffed1', cls.get_aggregation_column(), 'games_reffed'),
|
135
|
+
db.Index(f'idx_{cls.aggregation_type}_penalties_given1', cls.get_aggregation_column(), 'penalties_given'),
|
136
|
+
db.Index(f'idx_{cls.aggregation_type}_penalties_per_game1', cls.get_aggregation_column(), 'penalties_per_game'),
|
137
|
+
db.Index(f'idx_{cls.aggregation_type}_gm_given1', cls.get_aggregation_column(), 'gm_given'),
|
138
|
+
db.Index(f'idx_{cls.aggregation_type}_gm_per_game1', cls.get_aggregation_column(), 'gm_per_game')
|
139
|
+
)
|
140
|
+
|
141
|
+
@classmethod
|
142
|
+
def get_aggregation_column(cls):
|
143
|
+
raise NotImplementedError("Subclasses should implement this method to return the aggregation column name.")
|
144
|
+
|
145
|
+
class BaseStatsScorekeeper(db.Model):
|
146
|
+
__abstract__ = True
|
147
|
+
id = db.Column(db.Integer, primary_key=True)
|
148
|
+
human_id = db.Column(db.Integer, db.ForeignKey('humans.id'), nullable=False)
|
149
|
+
games_recorded = db.Column(db.Integer, default=0)
|
150
|
+
games_recorded_rank = db.Column(db.Integer, default=0)
|
151
|
+
sog_given = db.Column(db.Integer, default=0)
|
152
|
+
sog_given_rank = db.Column(db.Integer, default=0)
|
153
|
+
sog_per_game = db.Column(db.Float, default=0.0)
|
154
|
+
sog_per_game_rank = db.Column(db.Integer, default=0)
|
155
|
+
total_in_rank = db.Column(db.Integer, default=0)
|
156
|
+
first_game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
|
157
|
+
last_game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
|
158
|
+
|
159
|
+
@declared_attr
|
160
|
+
def __table_args__(cls):
|
161
|
+
return (
|
162
|
+
db.UniqueConstraint('human_id', cls.get_aggregation_column(), name=f'_human_{cls.aggregation_type}_uc_scorekeeper1'),
|
163
|
+
db.Index(f'idx_{cls.aggregation_type}_games_recorded1', cls.get_aggregation_column(), 'games_recorded'),
|
164
|
+
db.Index(f'idx_{cls.aggregation_type}_sog_given1', cls.get_aggregation_column(), 'sog_given'),
|
165
|
+
db.Index(f'idx_{cls.aggregation_type}_sog_per_game1', cls.get_aggregation_column(), 'sog_per_game')
|
166
|
+
)
|
167
|
+
|
168
|
+
@classmethod
|
169
|
+
def get_aggregation_column(cls):
|
170
|
+
raise NotImplementedError("Subclasses should implement this method to return the aggregation column name.")
|
171
|
+
|
172
|
+
class OrgStatsHuman(BaseStatsHuman):
|
173
|
+
__tablename__ = 'org_stats_human'
|
174
|
+
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
175
|
+
|
176
|
+
@declared_attr
|
177
|
+
def aggregation_type(cls):
|
178
|
+
return 'org'
|
179
|
+
|
180
|
+
@classmethod
|
181
|
+
def get_aggregation_column(cls):
|
182
|
+
return 'org_id'
|
183
|
+
|
184
|
+
class DivisionStatsHuman(BaseStatsHuman):
|
185
|
+
__tablename__ = 'division_stats_human'
|
186
|
+
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
187
|
+
|
188
|
+
@declared_attr
|
189
|
+
def aggregation_type(cls):
|
190
|
+
return 'division'
|
191
|
+
|
192
|
+
@classmethod
|
193
|
+
def get_aggregation_column(cls):
|
194
|
+
return 'division_id'
|
195
|
+
|
196
|
+
class OrgStatsSkater(BaseStatsSkater):
|
197
|
+
__tablename__ = 'org_stats_skater'
|
198
|
+
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
199
|
+
|
200
|
+
@declared_attr
|
201
|
+
def aggregation_type(cls):
|
202
|
+
return 'org'
|
203
|
+
|
204
|
+
@classmethod
|
205
|
+
def get_aggregation_column(cls):
|
206
|
+
return 'org_id'
|
207
|
+
|
208
|
+
class DivisionStatsSkater(BaseStatsSkater):
|
209
|
+
__tablename__ = 'division_stats_skater'
|
210
|
+
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
211
|
+
|
212
|
+
@declared_attr
|
213
|
+
def aggregation_type(cls):
|
214
|
+
return 'division'
|
215
|
+
|
216
|
+
@classmethod
|
217
|
+
def get_aggregation_column(cls):
|
218
|
+
return 'division_id'
|
219
|
+
|
220
|
+
class OrgStatsGoalie(BaseStatsGoalie):
|
221
|
+
__tablename__ = 'org_stats_goalie'
|
222
|
+
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
223
|
+
|
224
|
+
@declared_attr
|
225
|
+
def aggregation_type(cls):
|
226
|
+
return 'org'
|
227
|
+
|
228
|
+
@classmethod
|
229
|
+
def get_aggregation_column(cls):
|
230
|
+
return 'org_id'
|
231
|
+
|
232
|
+
class DivisionStatsGoalie(BaseStatsGoalie):
|
233
|
+
__tablename__ = 'division_stats_goalie'
|
234
|
+
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
235
|
+
|
236
|
+
@declared_attr
|
237
|
+
def aggregation_type(cls):
|
238
|
+
return 'division'
|
239
|
+
|
240
|
+
@classmethod
|
241
|
+
def get_aggregation_column(cls):
|
242
|
+
return 'division_id'
|
243
|
+
|
244
|
+
|
245
|
+
class OrgStatsReferee(BaseStatsReferee):
|
246
|
+
__tablename__ = 'org_stats_referee'
|
247
|
+
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
248
|
+
|
249
|
+
@declared_attr
|
250
|
+
def aggregation_type(cls):
|
251
|
+
return 'org'
|
252
|
+
|
253
|
+
@classmethod
|
254
|
+
def get_aggregation_column(cls):
|
255
|
+
return 'org_id'
|
256
|
+
|
257
|
+
class DivisionStatsReferee(BaseStatsReferee):
|
258
|
+
__tablename__ = 'division_stats_referee'
|
259
|
+
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
260
|
+
|
261
|
+
@declared_attr
|
262
|
+
def aggregation_type(cls):
|
263
|
+
return 'division'
|
264
|
+
|
265
|
+
@classmethod
|
266
|
+
def get_aggregation_column(cls):
|
267
|
+
return 'division_id'
|
268
|
+
|
269
|
+
|
270
|
+
class OrgStatsScorekeeper(BaseStatsScorekeeper):
|
271
|
+
__tablename__ = 'org_stats_scorekeeper'
|
272
|
+
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
273
|
+
|
274
|
+
@declared_attr
|
275
|
+
def aggregation_type(cls):
|
276
|
+
return 'org'
|
277
|
+
|
278
|
+
@classmethod
|
279
|
+
def get_aggregation_column(cls):
|
280
|
+
return 'org_id'
|
281
|
+
|
282
|
+
class DivisionStatsScorekeeper(BaseStatsScorekeeper):
|
283
|
+
__tablename__ = 'division_stats_scorekeeper'
|
284
|
+
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
285
|
+
|
286
|
+
@declared_attr
|
287
|
+
def aggregation_type(cls):
|
288
|
+
return 'division'
|
289
|
+
|
290
|
+
@classmethod
|
291
|
+
def get_aggregation_column(cls):
|
292
|
+
return 'division_id'
|
293
|
+
|
294
|
+
class OrgStatsDailyHuman(BaseStatsHuman):
|
295
|
+
__tablename__ = 'org_stats_daily_human'
|
296
|
+
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
297
|
+
|
298
|
+
@classmethod
|
299
|
+
def get_aggregation_column(cls):
|
300
|
+
return 'org_id'
|
301
|
+
|
302
|
+
@declared_attr
|
303
|
+
def aggregation_type(cls):
|
304
|
+
return 'org_daily'
|
305
|
+
|
306
|
+
class OrgStatsWeeklyHuman(BaseStatsHuman):
|
307
|
+
__tablename__ = 'org_stats_weekly_human'
|
308
|
+
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
309
|
+
|
310
|
+
@classmethod
|
311
|
+
def get_aggregation_column(cls):
|
312
|
+
return 'org_id'
|
313
|
+
|
314
|
+
@declared_attr
|
315
|
+
def aggregation_type(cls):
|
316
|
+
return 'org_weekly'
|
317
|
+
|
318
|
+
class DivisionStatsDailyHuman(BaseStatsHuman):
|
319
|
+
__tablename__ = 'division_stats_daily_human'
|
320
|
+
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
321
|
+
|
322
|
+
@classmethod
|
323
|
+
def get_aggregation_column(cls):
|
324
|
+
return 'division_id'
|
325
|
+
|
326
|
+
@declared_attr
|
327
|
+
def aggregation_type(cls):
|
328
|
+
return 'division_daily'
|
329
|
+
|
330
|
+
class DivisionStatsWeeklyHuman(BaseStatsHuman):
|
331
|
+
__tablename__ = 'division_stats_weekly_human'
|
332
|
+
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
333
|
+
|
334
|
+
@classmethod
|
335
|
+
def get_aggregation_column(cls):
|
336
|
+
return 'division_id'
|
337
|
+
|
338
|
+
@declared_attr
|
339
|
+
def aggregation_type(cls):
|
340
|
+
return 'division_weekly'
|
341
|
+
|
342
|
+
class OrgStatsDailySkater(BaseStatsSkater):
|
343
|
+
__tablename__ = 'org_stats_daily_skater'
|
344
|
+
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
345
|
+
|
346
|
+
@declared_attr
|
347
|
+
def aggregation_type(cls):
|
348
|
+
return 'org_daily'
|
349
|
+
|
350
|
+
@classmethod
|
351
|
+
def get_aggregation_column(cls):
|
352
|
+
return 'org_id'
|
353
|
+
|
354
|
+
class OrgStatsWeeklySkater(BaseStatsSkater):
|
355
|
+
__tablename__ = 'org_stats_weekly_skater'
|
356
|
+
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
357
|
+
|
358
|
+
@declared_attr
|
359
|
+
def aggregation_type(cls):
|
360
|
+
return 'org_weekly'
|
361
|
+
|
362
|
+
@classmethod
|
363
|
+
def get_aggregation_column(cls):
|
364
|
+
return 'org_id'
|
365
|
+
|
366
|
+
class DivisionStatsDailySkater(BaseStatsSkater):
|
367
|
+
__tablename__ = 'division_stats_daily_skater'
|
368
|
+
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
369
|
+
|
370
|
+
@declared_attr
|
371
|
+
def aggregation_type(cls):
|
372
|
+
return 'division_daily'
|
373
|
+
|
374
|
+
@classmethod
|
375
|
+
def get_aggregation_column(cls):
|
376
|
+
return 'division_id'
|
377
|
+
|
378
|
+
class DivisionStatsWeeklySkater(BaseStatsSkater):
|
379
|
+
__tablename__ = 'division_stats_weekly_skater'
|
380
|
+
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
381
|
+
|
382
|
+
@declared_attr
|
383
|
+
def aggregation_type(cls):
|
384
|
+
return 'division_weekly'
|
385
|
+
|
386
|
+
@classmethod
|
387
|
+
def get_aggregation_column(cls):
|
388
|
+
return 'division_id'
|
389
|
+
|
390
|
+
class OrgStatsDailyGoalie(BaseStatsGoalie):
|
391
|
+
__tablename__ = 'org_stats_daily_goalie'
|
392
|
+
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
393
|
+
|
394
|
+
@declared_attr
|
395
|
+
def aggregation_type(cls):
|
396
|
+
return 'org_daily'
|
397
|
+
|
398
|
+
@classmethod
|
399
|
+
def get_aggregation_column(cls):
|
400
|
+
return 'org_id'
|
401
|
+
|
402
|
+
class OrgStatsWeeklyGoalie(BaseStatsGoalie):
|
403
|
+
__tablename__ = 'org_stats_weekly_goalie'
|
404
|
+
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
405
|
+
|
406
|
+
@declared_attr
|
407
|
+
def aggregation_type(cls):
|
408
|
+
return 'org_weekly'
|
409
|
+
|
410
|
+
@classmethod
|
411
|
+
def get_aggregation_column(cls):
|
412
|
+
return 'org_id'
|
413
|
+
|
414
|
+
class DivisionStatsDailyGoalie(BaseStatsGoalie):
|
415
|
+
__tablename__ = 'division_stats_daily_goalie'
|
416
|
+
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
417
|
+
|
418
|
+
@declared_attr
|
419
|
+
def aggregation_type(cls):
|
420
|
+
return 'division_daily'
|
421
|
+
|
422
|
+
@classmethod
|
423
|
+
def get_aggregation_column(cls):
|
424
|
+
return 'division_id'
|
425
|
+
|
426
|
+
class DivisionStatsWeeklyGoalie(BaseStatsGoalie):
|
427
|
+
__tablename__ = 'division_stats_weekly_goalie'
|
428
|
+
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
429
|
+
|
430
|
+
@declared_attr
|
431
|
+
def aggregation_type(cls):
|
432
|
+
return 'division_weekly'
|
433
|
+
|
434
|
+
@classmethod
|
435
|
+
def get_aggregation_column(cls):
|
436
|
+
return 'division_id'
|
437
|
+
|
438
|
+
class OrgStatsDailyReferee(BaseStatsReferee):
|
439
|
+
__tablename__ = 'org_stats_daily_referee'
|
440
|
+
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
441
|
+
|
442
|
+
@declared_attr
|
443
|
+
def aggregation_type(cls):
|
444
|
+
return 'org_daily'
|
445
|
+
|
446
|
+
@classmethod
|
447
|
+
def get_aggregation_column(cls):
|
448
|
+
return 'org_id'
|
449
|
+
|
450
|
+
class OrgStatsWeeklyReferee(BaseStatsReferee):
|
451
|
+
__tablename__ = 'org_stats_weekly_referee'
|
452
|
+
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
453
|
+
|
454
|
+
@declared_attr
|
455
|
+
def aggregation_type(cls):
|
456
|
+
return 'org_weekly'
|
457
|
+
|
458
|
+
@classmethod
|
459
|
+
def get_aggregation_column(cls):
|
460
|
+
return 'org_id'
|
461
|
+
|
462
|
+
class DivisionStatsDailyReferee(BaseStatsReferee):
|
463
|
+
__tablename__ = 'division_stats_daily_referee'
|
464
|
+
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
465
|
+
|
466
|
+
@declared_attr
|
467
|
+
def aggregation_type(cls):
|
468
|
+
return 'division_daily'
|
469
|
+
|
470
|
+
@classmethod
|
471
|
+
def get_aggregation_column(cls):
|
472
|
+
return 'division_id'
|
473
|
+
|
474
|
+
class DivisionStatsWeeklyReferee(BaseStatsReferee):
|
475
|
+
__tablename__ = 'division_stats_weekly_referee'
|
476
|
+
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
477
|
+
|
478
|
+
@declared_attr
|
479
|
+
def aggregation_type(cls):
|
480
|
+
return 'division_weekly'
|
481
|
+
|
482
|
+
@classmethod
|
483
|
+
def get_aggregation_column(cls):
|
484
|
+
return 'division_id'
|
485
|
+
|
486
|
+
class OrgStatsDailyScorekeeper(BaseStatsScorekeeper):
|
487
|
+
__tablename__ = 'org_stats_daily_scorekeeper'
|
488
|
+
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
489
|
+
|
490
|
+
@declared_attr
|
491
|
+
def aggregation_type(cls):
|
492
|
+
return 'org_daily'
|
493
|
+
|
494
|
+
@classmethod
|
495
|
+
def get_aggregation_column(cls):
|
496
|
+
return 'org_id'
|
497
|
+
|
498
|
+
class OrgStatsWeeklyScorekeeper(BaseStatsScorekeeper):
|
499
|
+
__tablename__ = 'org_stats_weekly_scorekeeper'
|
500
|
+
org_id = db.Column(db.Integer, db.ForeignKey('organizations.id'), nullable=False)
|
501
|
+
|
502
|
+
@declared_attr
|
503
|
+
def aggregation_type(cls):
|
504
|
+
return 'org_weekly'
|
505
|
+
|
506
|
+
@classmethod
|
507
|
+
def get_aggregation_column(cls):
|
508
|
+
return 'org_id'
|
509
|
+
|
510
|
+
class DivisionStatsDailyScorekeeper(BaseStatsScorekeeper):
|
511
|
+
__tablename__ = 'division_stats_daily_scorekeeper'
|
512
|
+
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
513
|
+
|
514
|
+
@declared_attr
|
515
|
+
def aggregation_type(cls):
|
516
|
+
return 'division_daily'
|
517
|
+
|
518
|
+
@classmethod
|
519
|
+
def get_aggregation_column(cls):
|
520
|
+
return 'division_id'
|
521
|
+
|
522
|
+
class DivisionStatsWeeklyScorekeeper(BaseStatsScorekeeper):
|
523
|
+
__tablename__ = 'division_stats_weekly_scorekeeper'
|
524
|
+
division_id = db.Column(db.Integer, db.ForeignKey('divisions.id'), nullable=False)
|
525
|
+
|
526
|
+
@declared_attr
|
527
|
+
def aggregation_type(cls):
|
528
|
+
return 'division_weekly'
|
529
|
+
|
530
|
+
@classmethod
|
531
|
+
def get_aggregation_column(cls):
|
532
|
+
return 'division_id'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
from flask_migrate import Migrate
|
2
|
+
from flask import Flask
|
3
|
+
from .models import *
|
4
|
+
from .stats_models import *
|
5
|
+
from .stats_models import db
|
6
|
+
from .db_connection import get_db_params
|
7
|
+
|
8
|
+
app = Flask(__name__)
|
9
|
+
db_params = get_db_params("hockey-blast-radonly")
|
10
|
+
db_url = f"postgresql://{db_params['user']}:{db_params['password']}@{db_params['host']}:{db_params['port']}/{db_params['dbname']}"
|
11
|
+
app.config['SQLALCHEMY_DATABASE_URI'] = db_url
|
12
|
+
|
13
|
+
db.init_app(app)
|
14
|
+
migrate = Migrate(app, db)
|
15
|
+
|
16
|
+
# Export db and migrate for flask cli
|
@@ -0,0 +1,10 @@
|
|
1
|
+
hockey_blast_common_lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
hockey_blast_common_lib/db_connection.py,sha256=GPVaJRsZu38W9tDW1csoDX-cHuZA96GO2TGkpEy32JM,830
|
3
|
+
hockey_blast_common_lib/db_utils.py,sha256=GjtcQsSilR55GlLuFAzIGhEVYG3cve7KBkUggW03tDo,767
|
4
|
+
hockey_blast_common_lib/models.py,sha256=GqQIGpanmFub97BoYCuaqDov2MxM4LMesUTxZ2edpvw,15393
|
5
|
+
hockey_blast_common_lib/stats_models.py,sha256=PmFE6bqLvHo9LC1tyXliM-VG8mFalh0X8uDPd14zaIE,19744
|
6
|
+
hockey_blast_common_lib/wsgi.py,sha256=Qpux4NpQQnZ2U3gOAsqualn-bv9cLjFaXQtFQinC0j4,513
|
7
|
+
hockey_blast_common_lib-0.1.7.dist-info/METADATA,sha256=opn0hy1AmdbXJed8CTa5eb1oiHC84PGhk6I-8-d4TSk,317
|
8
|
+
hockey_blast_common_lib-0.1.7.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
9
|
+
hockey_blast_common_lib-0.1.7.dist-info/top_level.txt,sha256=wIR4LIkE40npoA2QlOdfCYlgFeGbsHR8Z6r0h46Vtgc,24
|
10
|
+
hockey_blast_common_lib-0.1.7.dist-info/RECORD,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
hockey_blast_common_lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
hockey_blast_common_lib/db_connection.py,sha256=4bN9pLynzOhd_9_u0bvQjgmE0qvkKHoOA95Ga3e_x7g,1361
|
3
|
-
hockey_blast_common_lib/db_utils.py,sha256=GjtcQsSilR55GlLuFAzIGhEVYG3cve7KBkUggW03tDo,767
|
4
|
-
hockey_blast_common_lib/models.py,sha256=Sfq1dwaDx4fQpfd66o1R_3AyRNKv34vjnvY4B-ebqg8,33910
|
5
|
-
hockey_blast_common_lib-0.1.6.dist-info/METADATA,sha256=y5wsjzJGFDx-qdCYnAABIwIXdwPJcYgrj0zCuaUTOFE,317
|
6
|
-
hockey_blast_common_lib-0.1.6.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
7
|
-
hockey_blast_common_lib-0.1.6.dist-info/top_level.txt,sha256=wIR4LIkE40npoA2QlOdfCYlgFeGbsHR8Z6r0h46Vtgc,24
|
8
|
-
hockey_blast_common_lib-0.1.6.dist-info/RECORD,,
|
File without changes
|
{hockey_blast_common_lib-0.1.6.dist-info → hockey_blast_common_lib-0.1.7.dist-info}/top_level.txt
RENAMED
File without changes
|