results.views package#
Submodules#
results.views.core module#
- results.views.core.dealer_and_vulnerability_for_board(board_number)[source]#
return the vulnerability and dealer for a board
- results.views.core.double_dummy_from_usebio(board)[source]#
perform a double dummy analysis of a hand. This requires libdds.so to be available on the path. See the documentation if you need to rebuild this for your OS. It works fine on Linux out of the box. Nothing extra required, just pip install ddstable.
We expect to get part of the USEBIO XML - [‘USEBIO’][“HANDSET”][“BOARD”][?]
Data contains a list with direction and suits (‘DIRECTION’, ‘East’), (‘CLUBS’, ‘Q6542’), (‘DIAMONDS’, ‘85’),…
- results.views.core.get_recent_results(user)[source]#
Return the 5 most recent results for a user. Called by Dashboard
- results.views.core.get_results_statistics()[source]#
return basic stats on results. Called by utils statistics
- results.views.core.higher_than_other_suit(suit, other_suit)[source]#
Checks if a suit is higher than another in bridge terms
- results.views.core.is_making_contract(dds_table, contract, declarer)[source]#
Check in the dds table to see if this contract makes
- results.views.core.lower_than_other_contract(contract, other_contract)[source]#
Checks if a contract is lower than another in bridge terms
- results.views.core.next_contract_up(contract)[source]#
return next contract or False. 4N -> 5C, 1S -> 1N, 7N -> False.
Ignores X or XX
- results.views.core.score_for_contract(contract, vulnerability, declarer, tricks_taken)[source]#
Calculate the score for any contract
- Parameters:
contract (str) – contract in the form NCD where N is a number 1-7, C is a letter (C/D/H/S/N) and D can be X or XX
vulnerability (str) – vulnerability for this board
declarer (str) – N/S/E/W
tricks_taken (int) – 0-13
results.views.home module#
- results.views.home.all_results_paginator_htmx(request, query_only=False)[source]#
show pages for the recent results. Returns paginated query set or HttpResponse.
Can be called by the main results page to build the initial list or by the htmx call to paginate
- results.views.home.club_results_paginator_htmx(request, query_only=False)[source]#
show pages for the recent results. Returns paginated query set or HttpResponse.
Can be called by the main results page to build the initial list or by the htmx call to paginate
- results.views.home.home(request)[source]#
Show main page when user clicks on Results from the main side menu
results.views.par_contract module#
- results.views.par_contract.par_score_and_contract(dds_table, vulnerability, dealer)[source]#
Calculate the par score for a hand. Par score is the best score for both sides if they bid to the perfect double dummy contract. Sacrifices are always doubled.
https://bridgecomposer.com/Par.htm
- Parameters:
dds_table (str) – output from double_dummy_from_usebio()
vulnerability (str) – for this board NS/EW/All/Nil
dealer (str) – N/S/E/W
results.views.results_views module#
- results.views.results_views.calculate_hcp_and_ltc(hand)[source]#
calculate the high card points and losing trick count for this board
- results.views.results_views.get_traveller_info(usebio, board_number, player_dict, ns_flag, pair_id, request)[source]#
extract traveller information about a board from a usebio record
- results.views.results_views.show_results_for_club_htmx(request)[source]#
Show recent results for a club. Called from the club org_profile.
- results.views.results_views.usebio_mp_pairs_board_view(request, results_file_id, board_number, pair_id)[source]#
Show the traveller for a board. If pair_id is provided then we show it from the perspective of that pair. Pair id will be 0 if not provided
- results.views.results_views.usebio_mp_pairs_details_view(request, results_file_id, pair_id)[source]#
Show the board by board results for a pair
- results.views.results_views.usebio_mp_pairs_results_summary_view(request, results_file_id)[source]#
Show the summary results for a usebio format event
results.views.usebio module#
- results.views.usebio.boards_from_usebio(results_file: ResultsFile) list [source]#
returns the boards from a usebio results file
- results.views.usebio.create_player_records_from_usebio_format_pairs(results_file: ResultsFile, xml: dict)[source]#
take in a xml usebio structure and generate the PlayerSummaryResult records for pairs event
- results.views.usebio.parse_usebio_file(results_file)[source]#
read a USEBIO format XML file that has already been uploaded and turn into a dictionary
- results.views.usebio.players_from_usebio(results_file: ResultsFile) list [source]#
returns the players from a usebio results file