Difference between revisions of "The DRAFT1846Last Page"

From BOARD18 Project WIKI
Jump to navigation Jump to search
(Created page with "{{Draft1846 Design Document Index}} The draft1846Last page is called from an email generated by a previous iteration of draft1846Last or by draft1846Next.<br> This page hand...")
(No difference)

Revision as of 14:09, 21 May 2020

DRAFT1846 Design edit


The draft1846Last page is called from an email generated by a previous iteration of draft1846Last or by draft1846Next.
This page handles the special case when only one private and no blank cards are left to be chosen.
If the active player takes the private the draft is over.
But if he passes then the draft1846Last page sends an email to the next player for him to take his turn.

function getDraftResult(result)

The getDraftResult function is the call back function for the ajax call to getDraft.php. It checks that it is the current players turn and sets up the first part of the draft1846Last page.

Output from getDraft.php is a json encoded array. The "return" value will be either "success" or "fail". If it is "fail" then it will be the only item in the array. If the "return" value is "success", then the rest of the array will be the json string from the specified table row.

function processLastSelection()

The processLastSelection function uses the last card to update the current player's hand.It then calls updateDraft.php to update the draft record.

function processPass()

The processPass function saves the updated value of D1846.draft.cpd to the database. It then causes updateDraftResult to send an email to the next player.

function updateDraftResult(result)

The updateDraftResult function is the call back function for the ajax calls to updateDraft.php. It checks for collisions. Then I checks if the draft has completed. If the draft is over then it calls the finishDraft() function.

If the draft is not over then the next player needs to be informed that it is now his turn. To do this the updateDraftResult function will send an email directing the next player to the draft1846Last page.

function nextEmailResult(response)

Function nextEmailsResult is the call back function for the ajax call to emailNext.php. It only needs to check for errors.

function finishDraft()

The finishDraft function updates the draft status to "Done". It then calls updtDraft.php to do the final update to the draft.

function finishDraftResult(result)

The finishDraftResult function is the call back function for the ajax call by the finishDraft function to updtDraft.php. It checks for collisions. Then it uses emailDone.php to send a completed email to each player and finally it calls the draftDone() function.

function doneEmailResult(response)

The doneEmailResult function is the call back function for the ajax call to emailDone.php. It will have to process returns from multiple emails for the same call. It only needs to check for errors and it only needs to report the first error.