JSON Data Object Key/Value Pairs

From BOARD18 Project WIKI
Jump to navigation Jump to search

The "draft" field in the draft_table of the DRAFT1846 database is a stringified JSON structure.
This structure contains key/value pairs that are each explained here.

The status key/value pair

The status value is a text string used to track the progress of the draft.
It can have any one of these 5 values:

  1. Pending: Still waiting for at least one player to confirm.
  2. Confirmed: All players have confirmed their email addresses.
  3. Active: The draft is active and more than one card is left.
  4. Last: The last remaining private is being processed.
  5. Done: The draft is completed.

The updtCount key/value pair

The updtCount value is an integer used to support a week version of optimistic database locking.

The numbPlayers key/value pair

The numbPlayers value is the number of players in the draft.

The curPlayer key/value pair

The curPlayer value is the player ID of the player currently taking his/her turn.

The cpd key/value pair

The cpd value is an integer used to keep track of the discount being applied to a private.
It is only used by the draft1846Last page.

The deck key/value pair

The deck value is an array that currently contains a list of the nine cards being used in this draft.

The hand key/value pair

The hand value is an empty array. It will contain the hand being delt to a player during his turn in the draft.

The players key/value pair

The players value is an array that contains a sub array for each player in the draft.
Each player sub array contains the following items.

The name key/value pair

The players value is player name that was entered on the draft1846Start form.

The email key/value pair

The email value is the players email address that was entered on the draft1846Start form.

The confirmed key/value pair

The confirmed value is initially No. It is changed to Yes when the player's email address is confirmed.

The cash key/value pair

The cash value is the remaining cash that the player has.

The privates key/value pair

The privates value is an array that contains all of the cards that the player has purchased.

The urlKey key/value pair

The urlKey value is a pseudo random key based on the relevant draftID and playerID.

The return key/value pair

The return value is a text string used to return the success or failure status of a PHP AJAX call to a php program.
The actual value of the string is dependent on the php program in question and is documented there.
This key/value pair will not actually be part of the draft_table fiels until an AJAX call is acctually made to a php program.