masterpoints package#

Submodules#

masterpoints.admin module#

masterpoints.apps module#

class masterpoints.apps.MasterpointsConfig(app_name, app_module)[source]#

Bases: AppConfig

name = 'masterpoints'#

masterpoints.factories module#

class masterpoints.factories.MasterpointDB[source]#

Bases: MasterpointFactory

Concrete implementation of a masterpoint factory using a database to get the data

get_masterpoints(system_number)[source]#

Get total masterpoints

system_number_lookup(system_number)[source]#

Look up the system number and return name

system_number_lookup_api(system_number)[source]#

Called by the API

system_number_valid(system_number)[source]#

Checks if this is valid, returns boolean. To be valid this must exist in the MPC with IsActive True and not already be a user in the system

user_summary(system_number)[source]#

Get basic information about a user

class masterpoints.factories.MasterpointFactory[source]#

Bases: object

Abstract class for accessing masterpoint data

class Meta[source]#

Bases: object

abstract = True#
get_masterpoints(system_number)[source]#

Get total masterpoints

system_number_lookup(system_number)[source]#

Look up the system number and return name

system_number_valid(system_number)[source]#

Look up the system number and return True if okay to add this user

user_summary(system_number)[source]#

Get basic information about a user

class masterpoints.factories.MasterpointFile[source]#

Bases: MasterpointFactory

Concrete implementation of a masterpoint factory using a file to get the data

get_masterpoints(system_number)[source]#

Get total masterpoints

system_number_lookup(system_number)[source]#

Look up the system number and return name

system_number_valid(system_number)[source]#

Checks if this is valid, returns boolean. To be valid this must exist in the MPC with IsActive True and not already be a user in the system

user_summary(system_number)[source]#

Get basic information about a user

masterpoints.factories.masterpoint_factory_creator()[source]#
masterpoints.factories.masterpoint_query_list(query)[source]#

Generic function to talk to the masterpoints SQL Server and return data as a list

masterpoints.factories.masterpoint_query_row(query)[source]#

Generic function to get first row from query

masterpoints.factories.mp_file_grep(pattern)[source]#

masterpoints.models module#

masterpoints.tests module#

masterpoints.urls module#

masterpoints.views module#

masterpoints.views.abf_checksum_is_valid(abf_number: int) bool[source]#

Takes an ABF number and confirms the number has a valid checksum. Doesn’t check with the MPC to see if this is a valid number (not inactive, actually registered etc).

masterpoints.views.abf_registration_card(request)[source]#

Logged out search for user to print a registration card

masterpoints.views.abf_registration_card_htmx(request)[source]#

Perform the user search and return the list

masterpoints.views.download_abf_card_pdf(request)[source]#

Downloads a PDF with basic information about this registered user

masterpoints.views.get_abf_checksum(abf_raw: int) int[source]#

Calculate the checksum for an ABF number given the raw number without the checksum

Formula is:

convert to 6 digit with leading 0, e.g. 62024 becomes 062024 total is 0th place x 7, 1st place x 6, 2nd place x 5 etc result = total mod 11 if result = 0 checksum = 0 else checksum = 11 - (result mod 11)

masterpoints.views.get_masterpoints(system_number)[source]#
masterpoints.views.masterpoint_query_local(query)[source]#

Generic function to talk to the masterpoints server and return data

THIS IS A DUPLICATE OF THE FUNCTION IN UTILS/UTIL_VIEWS/MASTERPOINTS due to circular dependency problems.

Takes in a SQLServer query e.g. “select count(*) from table”

Returns an iterable, either an empty list or the response from the server.

In case there is a problem connecting to the server, this will do everything it can to fail silently.

masterpoints.views.masterpoints_detail(request, system_number=None, years=1, retry=False)[source]#
masterpoints.views.process_transactions(details, month, year)[source]#

Separate process and provisional details add formatting to the matchpoint numbers

masterpoints.views.search_mpc_users_by_name(first_name_search, last_name_search)[source]#

search the masterpoint centre for users by first and last name

masterpoints.views.system_number_available(system_number)[source]#

Called from the registration page. Takes in a system number and returns True if number is valid and available

masterpoints.views.system_number_lookup(request)[source]#

Called from the registration page. Takes in a system number and returns the member first and lastname or an error message.

masterpoints.views.user_summary(system_number)[source]#

This is only here until we move masterpoints into Cobalt. It gets basic things such as home club and masterpoints.

Module contents#