hockey-blast-common-lib 0.1.31__tar.gz → 0.1.32__tar.gz

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.
Files changed (27) hide show
  1. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/PKG-INFO +1 -1
  2. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib/assign_skater_skill.py +7 -5
  3. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib/hockey_blast_sample_backup.sql.gz +0 -0
  4. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib/models.py +1 -0
  5. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib/skills_in_divisions.py +0 -1
  6. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib.egg-info/PKG-INFO +1 -1
  7. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/setup.py +1 -1
  8. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/MANIFEST.in +0 -0
  9. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/README.md +0 -0
  10. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib/__init__.py +0 -0
  11. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib/aggregate_goalie_stats.py +0 -0
  12. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib/aggregate_human_stats.py +0 -0
  13. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib/aggregate_referee_stats.py +0 -0
  14. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib/aggregate_skater_stats.py +0 -0
  15. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib/db_connection.py +0 -0
  16. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib/dump_sample_db.sh +0 -0
  17. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib/options.py +0 -0
  18. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib/restore_sample_db.sh +0 -0
  19. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib/skills_propagation.py +0 -0
  20. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib/stats_models.py +0 -0
  21. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib/utils.py +0 -0
  22. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib/wsgi.py +0 -0
  23. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib.egg-info/SOURCES.txt +0 -0
  24. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib.egg-info/dependency_links.txt +0 -0
  25. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib.egg-info/requires.txt +0 -0
  26. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/hockey_blast_common_lib.egg-info/top_level.txt +0 -0
  27. {hockey_blast_common_lib-0.1.31 → hockey_blast_common_lib-0.1.32}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hockey-blast-common-lib
3
- Version: 0.1.31
3
+ Version: 0.1.32
4
4
  Summary: Common library for shared functionality and DB models
5
5
  Author: Pavel Kletskov
6
6
  Author-email: kletskov@gmail.com
@@ -3,17 +3,19 @@ import sys, os
3
3
  # Add the package directory to the Python path
4
4
  sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
5
5
 
6
- from hockey_blast_common_lib.models import Human, LevelStatsSkater
6
+ from hockey_blast_common_lib.models import Human, Level
7
+ from hockey_blast_common_lib.stats_models import LevelStatsSkater
7
8
  from hockey_blast_common_lib.db_connection import create_session
8
9
  from sqlalchemy.sql import func
9
10
 
10
- def calculate_skater_skill_value(human_id, level_stats):
11
+ def calculate_skater_skill_value(session, human_id, level_stats):
11
12
  max_skill_value = 0
12
13
 
13
14
  for stat in level_stats:
14
- level_skill_value = stat.level.skill_value
15
- if level_skill_value < 0:
15
+ level = session.query(Level).filter(Level.id == stat.level_id).first()
16
+ if not level or level.skill_value < 0:
16
17
  continue
18
+ level_skill_value = level.skill_value
17
19
  ppg_ratio = stat.points_per_game_rank / stat.total_in_rank
18
20
  games_played_ratio = stat.games_played_rank / stat.total_in_rank
19
21
 
@@ -33,7 +35,7 @@ def assign_skater_skill_values():
33
35
  for human in humans:
34
36
  level_stats = session.query(LevelStatsSkater).filter(LevelStatsSkater.human_id == human.id).all()
35
37
  if level_stats:
36
- skater_skill_value = calculate_skater_skill_value(human.id, level_stats)
38
+ skater_skill_value = calculate_skater_skill_value(session, human.id, level_stats)
37
39
  human.skater_skill_value = skater_skill_value
38
40
  session.commit()
39
41
 
@@ -106,6 +106,7 @@ class Human(db.Model):
106
106
  last_name = db.Column(db.String(100))
107
107
  first_date = db.Column(db.Date)
108
108
  last_date = db.Column(db.Date)
109
+ skater_skill_value = db.Column(db.Float, nullable=True)
109
110
  __table_args__ = (
110
111
  db.UniqueConstraint('first_name', 'middle_name', 'last_name', name='_human_name_uc'),
111
112
  )
@@ -140,6 +140,5 @@ def populate_league_ids():
140
140
  if __name__ == "__main__":
141
141
  # delete_all_skills()
142
142
  #fill_seed_skills()
143
- reset_skill_values_in_divisions()
144
143
  #populate_season_ids() # Call the function to populate season_ids
145
144
  #populate_league_ids() # Call the new function to populate league_ids
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hockey-blast-common-lib
3
- Version: 0.1.31
3
+ Version: 0.1.32
4
4
  Summary: Common library for shared functionality and DB models
5
5
  Author: Pavel Kletskov
6
6
  Author-email: kletskov@gmail.com
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='hockey-blast-common-lib', # The name of your package
5
- version='0.1.31',
5
+ version='0.1.32',
6
6
  description='Common library for shared functionality and DB models',
7
7
  author='Pavel Kletskov',
8
8
  author_email='kletskov@gmail.com',