Last active
June 7, 2020 17:30
-
-
Save huwcbjones/7470cb95ee01814697fe26907b11b734 to your computer and use it in GitHub Desktop.
SportSystems ClubRankings licence to RankingsDB password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""ClubRankings utilities""" | |
def get_username(club_code: str, customer_number: int) -> str: | |
""" | |
Get the RankingsDB username | |
:param club_code: 4 letter club code | |
:param customer_number: customer code | |
""" | |
return f"CR_{club_code}_{customer_number}" | |
def get_password(meet_code: str, club_code: str, customer_number: int, licence_key: str) -> str: | |
""" | |
Get the RankingsDB password | |
:param meet_code: Licensed Meet Code | |
:param club_code: 4 letter club code | |
:param customer_number: customer code | |
:param licence_key: Club Rankings licence key | |
""" | |
licence_key = licence_key.replace("-", "") | |
a_block = licence_key[ 0: 4] | |
b_block = licence_key[ 4: 8] | |
c_block = licence_key[ 8:12] | |
d_block = licence_key[12:16] | |
e_block = licence_key[16:20] | |
f_block = licence_key[20:24] | |
g_block = licence_key[24:] | |
return "{}{}{}{}{}{}{}{}{}{}".format( | |
a_block, | |
club_code, | |
d_block, | |
f_block, | |
meet_code, | |
c_block, | |
g_block, | |
customer_number, | |
e_block, | |
b_block | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment