hockey-blast-common-lib 0.1.34__py3-none-any.whl → 0.1.36__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.
@@ -224,7 +224,7 @@ class Organization(db.Model):
224
224
  id = db.Column(db.Integer, primary_key=True)
225
225
  alias = db.Column(db.String(100), unique=True)
226
226
  organization_name = db.Column(db.String(100), unique=True)
227
- website = db.Column(db.String(100), nullable=True) # New field for website
227
+ website = db.Column(db.String(100), nullable=True)
228
228
 
229
229
  class Penalty(db.Model):
230
230
  __tablename__ = 'penalties'
@@ -7,6 +7,7 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
7
7
 
8
8
  from hockey_blast_common_lib.models import Game, Division, Level, Season, League
9
9
  from hockey_blast_common_lib.db_connection import create_session
10
+ from hockey_blast_common_lib.utils import get_fake_level
10
11
 
11
12
  def analyze_levels(org):
12
13
  session = create_session(org)
@@ -76,22 +77,6 @@ def fill_seed_skills():
76
77
 
77
78
  print("Seed skills have been populated into the database.")
78
79
 
79
- def get_fake_skill(session):
80
- # Create a special fake Skill with org_id == -1 and skill_value == -1
81
- fake_skill = session.query(Level).filter_by(org_id=1, level_name='Fake Skill').first()
82
- if not fake_skill:
83
- fake_skill = Level(
84
- org_id=1,
85
- skill_value=-1,
86
- level_name='Fake Skill',
87
- level_alternative_name='',
88
- is_seed=False
89
- )
90
- session.add(fake_skill)
91
- session.commit()
92
- print("Created special fake Skill record.")
93
- return fake_skill
94
-
95
80
  def assign_fake_skill_to_divisions(session, fake_skill):
96
81
  # Assign the special fake Skill to every existing Division
97
82
  divisions = session.query(Division).all()
@@ -102,7 +87,7 @@ def assign_fake_skill_to_divisions(session, fake_skill):
102
87
 
103
88
  def delete_all_skills():
104
89
  session = create_session("boss")
105
- fake_skill = get_fake_skill(session)
90
+ fake_skill = get_fake_level(session)
106
91
  assign_fake_skill_to_divisions(session, fake_skill)
107
92
  # Delete all Skill records except the fake skill
108
93
  session.query(Level).filter(Level.id != fake_skill.id).delete(synchronize_session=False)
@@ -5,7 +5,7 @@ from datetime import datetime, timedelta
5
5
  # Add the package directory to the Python path
6
6
  sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
7
7
 
8
- from hockey_blast_common_lib.models import Organization, Human, Division
8
+ from hockey_blast_common_lib.models import Organization, Human, Division, Level
9
9
  from sqlalchemy.sql import func
10
10
 
11
11
 
@@ -98,6 +98,22 @@ def assign_ranks(stats_dict, field, reverse_rank=False):
98
98
  for rank, (key, stat) in enumerate(sorted_stats, start=1):
99
99
  stats_dict[key][f'{field}_rank'] = rank
100
100
 
101
+ def get_fake_level(session):
102
+ # Create a special fake Skill with org_id == -1 and skill_value == -1
103
+ fake_skill = session.query(Level).filter_by(org_id=1, level_name='Fake Skill').first()
104
+ if not fake_skill:
105
+ fake_skill = Level(
106
+ org_id=1,
107
+ skill_value=-1,
108
+ level_name='Fake Skill',
109
+ level_alternative_name='',
110
+ is_seed=False
111
+ )
112
+ session.add(fake_skill)
113
+ session.commit()
114
+ print("Created special fake Skill record.")
115
+ return fake_skill
116
+
101
117
  #TEST DB CONNECTION, PERMISSIONS...
102
118
  # from hockey_blast_common_lib.db_connection import create_session
103
119
  # session = create_session("frontend")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hockey-blast-common-lib
3
- Version: 0.1.34
3
+ Version: 0.1.36
4
4
  Summary: Common library for shared functionality and DB models
5
5
  Author: Pavel Kletskov
6
6
  Author-email: kletskov@gmail.com
@@ -7,17 +7,17 @@ hockey_blast_common_lib/aggregate_skater_stats.py,sha256=LY6temy5zzqJ85ENymt9nEf
7
7
  hockey_blast_common_lib/assign_skater_skill.py,sha256=p-0fbodGpM8BCjKHDpxNb7BH2FcIlBsJwON844KNrUY,1817
8
8
  hockey_blast_common_lib/db_connection.py,sha256=HvPxDvOj7j5H85RfslGvHVNevfg7mKCd0syJ6NX21mU,1890
9
9
  hockey_blast_common_lib/dump_sample_db.sh,sha256=MHPA-Ciod7wsvAlMbRtXFiyajgnEqU1xR59sJQ9UWR0,738
10
- hockey_blast_common_lib/hockey_blast_sample_backup.sql.gz,sha256=9xsTyRZZa0eVIvEwa1IdsogVX83lidXQhTm2nOGUU3M,1033689
11
- hockey_blast_common_lib/models.py,sha256=Gh0WgYdZE6ClF_48t7zk3G0CItf02yHVzi43afshAgQ,16064
10
+ hockey_blast_common_lib/hockey_blast_sample_backup.sql.gz,sha256=8t-x49pAwLveBms9deboI5VS4v0naBx94fDLk-OEres,1033686
11
+ hockey_blast_common_lib/models.py,sha256=WLFPFoI3Rr_M58Vn8Ear2GrKW0bYPmBZFpYNb_sVRls,16039
12
12
  hockey_blast_common_lib/options.py,sha256=6na8fo-5A2RBPpd_h-7dsqetOLSLoNEJg1QMYgl4jNs,792
13
13
  hockey_blast_common_lib/restore_sample_db.sh,sha256=u2zKazC6vNMULkpYzI64nlneCWaGUtDHPBAU-gWgRbw,1861
14
- hockey_blast_common_lib/skills_in_divisions.py,sha256=RR-x-D7V_lQX--2a2GHEYHtATtIOj2ACpvcEUDzVgkY,7487
14
+ hockey_blast_common_lib/skills_in_divisions.py,sha256=l6K0c6iikTJ6hZWsMA9uOWQlwPU6vHf7oXGU7lrYWjg,7005
15
15
  hockey_blast_common_lib/skills_propagation.py,sha256=x6yy7fJ6IX3YiHqiP_v7-p_S2Expb8JJ-mWuajEFBdY,16388
16
16
  hockey_blast_common_lib/stats_models.py,sha256=qvkt-XRFb4ZW7yBj7vltedzUS_YwWagm_efMRcsioSA,25120
17
17
  hockey_blast_common_lib/stats_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
- hockey_blast_common_lib/utils.py,sha256=EDMBiWpF2bNCC1xc1WUNahQlUsG8bv1Wh0Eal3Iw2ls,4689
18
+ hockey_blast_common_lib/utils.py,sha256=Sy5Pk40Tk3gsMrhMsUMlBD7i7jiVZmWLUBc94qI3zOA,5235
19
19
  hockey_blast_common_lib/wsgi.py,sha256=7LGUzioigviJp-EUhSEaQcd4jBae0mxbkyBscQfZhlc,730
20
- hockey_blast_common_lib-0.1.34.dist-info/METADATA,sha256=ROphG8zkwmNGOdHFyrafZ2cJAUBEuvr_-LZ6rBxMPEY,318
21
- hockey_blast_common_lib-0.1.34.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
22
- hockey_blast_common_lib-0.1.34.dist-info/top_level.txt,sha256=wIR4LIkE40npoA2QlOdfCYlgFeGbsHR8Z6r0h46Vtgc,24
23
- hockey_blast_common_lib-0.1.34.dist-info/RECORD,,
20
+ hockey_blast_common_lib-0.1.36.dist-info/METADATA,sha256=OYnpbj9-tLO4ABZX60Pihc0cijEGG0Kgj1tpiEwtFlE,318
21
+ hockey_blast_common_lib-0.1.36.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
22
+ hockey_blast_common_lib-0.1.36.dist-info/top_level.txt,sha256=wIR4LIkE40npoA2QlOdfCYlgFeGbsHR8Z6r0h46Vtgc,24
23
+ hockey_blast_common_lib-0.1.36.dist-info/RECORD,,