Difference between revisions of "Design Document For DRAFT1846"

From BOARD18 Project WIKI
Jump to navigation Jump to search
 
(7 intermediate revisions by the same user not shown)
Line 14: Line 14:
== DRAFT1846 Logic Flow ==
== DRAFT1846 Logic Flow ==
The diagram to the right shows a simplified version of the control flow between the DRAFT1846 pages. <br>
The diagram to the right shows a simplified version of the control flow between the DRAFT1846 pages. <br>
Note that though many details (and one page) have been omitted from this diagram, it is still generally correct.
Note that though many details have been omitted from this diagram, it is still generally correct.


This section contains a link to a WIKI page describing in detail each DRAFT1846 page. <br>
This section contains a link to a WIKI page describing in detail each DRAFT1846 page. <br>
Line 28: Line 28:
*[[The DRAFT1846Com File]]
*[[The DRAFT1846Com File]]


== DRAFT1846 Server Functions ==
== DRAFT1846 Server Side ==
The server side processing for DRAFT1846 is done in stand alone PHP programs that are executed from the web pages via AJAX calls. <br>
The server side processing for DRAFT1846 is done in stand alone PHP programs that are executed from these web pages via AJAX calls. <br>
This section contains a link to a WIKI page section describing
Below is a link to a WIKI page containing descriptions of each of these PHP programs.
in detail each of these PHP functions.
 
[[DRAFT1846 Server Side Programs]]


== Database Structure ==
== Database Structure ==
Line 48: Line 49:
The draft field is a text string containing the stringafied JSON data object as shown below.
The draft field is a text string containing the stringafied JSON data object as shown below.


== JASON Data Object ==
== JSON Data Object ==
This Object contains all of the information about a given draft except for the Draft ID.
This object contains all of the information about a given draft except for the Draft ID.<br>
It is stored in the table as a stringified json object called '''draft''' and appears to javascript as nested array.<br>
The sample object below has just been created by logic on the draft1846Start page.
 
'''[[JSON Data Object Key/Value Pairs|<span style="color: Green">Click here to access a detailed description of this JSON Data Object </span>]]'''
 
<pre>  
<pre>  
array (
array (
   'status' => 'Last',
   'status' => 'Pending',
   'updtCount' => 10,
   'updtCount' => 1,
   'numbPlayers' => 3,
   'numbPlayers' => 3,
   'curPlayer' => 2,
   'curPlayer' => 1,
   'cpd' => 20,
   'cpd' => 0,
   'deck' =>  
   'deck' =>  
   array (
   array (
    0 => 'Chicago and W. Indiana',
    1 => 'Blank Card',
    2 => 'Mail Contract',
    3 => 'Michigan Southern',
    4 => 'Ohio and Indiana',
    5 => 'Tunnel Blasting Co.',
    6 => 'Blank Card',
    7 => 'Blank Card',
    8 => 'Big 4',
   ),
   ),
   'hand' =>  
   'hand' =>  
   array (
   array (
    0 => 'Mail Contract',
   ),
   ),
   'players' =>  
   'players' =>  
Line 70: Line 84:
       'name' => 'rich3',
       'name' => 'rich3',
       'email' => 'richpri46@gmail.com',
       'email' => 'richpri46@gmail.com',
       'confirmed' => 'Yes',
       'confirmed' => 'No',
       'cash' => 200,
       'cash' => 400,
       'privates' =>  
       'privates' =>  
       array (
       array (
        0 => 'Tunnel Blasting Co.',
        1 => 'Blank Card',
        2 => 'Michigan Southern',
       ),
       ),
      'urlKey' => '00271U01D3ZC',
     ),
     ),
     1 =>  
     1 =>  
Line 83: Line 95:
       'name' => 'rich2',
       'name' => 'rich2',
       'email' => 'richpri46@gmail.com',
       'email' => 'richpri46@gmail.com',
       'confirmed' => 'Yes',
       'confirmed' => 'No',
       'cash' => 240,
       'cash' => 400,
       'privates' =>  
       'privates' =>  
       array (
       array (
        0 => 'Big 4',
        1 => 'Chicago and W. Indiana',
        2 => 'Blank Card',
       ),
       ),
      'urlKey' => '00272X00VJ71',
     ),
     ),
     2 =>  
     2 =>  
Line 96: Line 106:
       'name' => 'rich1',
       'name' => 'rich1',
       'email' => 'richpri46@gmail.com',
       'email' => 'richpri46@gmail.com',
       'confirmed' => 'Yes',
       'confirmed' => 'No',
       'cash' => 360,
       'cash' => 400,
       'privates' =>  
       'privates' =>  
       array (
       array (
        0 => 'Ohio and Indiana',
        1 => 'Blank Card',
       ),
       ),
      'urlKey' => '0027373K05DF',
     ),
     ),
   ),
   ),
  'return' => 'success',
)
)
</pre>
</pre>
== Some Fields of Note ==
The "draft" database table field is a stringified JSON structure.<br>
This structure contains some key/value pairs that could use some explanation as to their use.<br>
A number of these key/value pairs are mentioned here.
=== The status key/value pair ===
The status value is a text string used to track the progress of the draft.<br>
It can have any one of these 5 values:
#Pending: Still waiting for at least one player to confirm.
#Confirmed: All players have confirmed their email addresses.
#Active: The draft is active and more than one card is left.
#Last: The last remaining private is being processed.
#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.<br>
=== The cpd key/value pair ===
The cpd value is an integer used to keep track of the discount being applied to a private.<br>
It is only used by the draft1846Last page.
=== The return key/value pair ===
The return value is a text string used to return the success or failure status of a call to a php module.<br>
The actual value of the string is dependent on the php module in question and is documented there.


[[Category:Design]]
[[Category:Design]]

Latest revision as of 14:55, 27 October 2020

DraftFlow.png

Introduction

DRAFT1846 has been designed to look and feel as much like BOARD18 as possible.

This means that a couple of the sections of the BOARD18 design document can be applied, for the most part, directly to DRAFT1846.

These sections are:

DRAFT1846 is a multi page email driven application. With two exceptions, emails are always used to pass control between pages.
The exceptions are the DRAFT1846Start page which is directly executed by the index.html page and the DRAFT1846Goodby page which is used as an exit mechanism by most of the other pages.

DRAFT1846 Logic Flow

The diagram to the right shows a simplified version of the control flow between the DRAFT1846 pages.
Note that though many details have been omitted from this diagram, it is still generally correct.

This section contains a link to a WIKI page describing in detail each DRAFT1846 page.
Each such WIKI page list all of the functions contained in that DRAFT1846 page.
The last link below points to a WIKI page describing a repository of common functions.

DRAFT1846 Server Side

The server side processing for DRAFT1846 is done in stand alone PHP programs that are executed from these web pages via AJAX calls.
Below is a link to a WIKI page containing descriptions of each of these PHP programs.

DRAFT1846 Server Side Programs

Database Structure

The DRAFT1846 database is structured as follows:

 
mysql> show columns from draft_table;
+---------------+------------------+------+-----+-------------------+-----------------------------+
| Field         | Type             | Null | Key | Default           | Extra                       |
+---------------+------------------+------+-----+-------------------+-----------------------------+
| draft_id      | int(11) unsigned | NO   | PRI | NULL              | auto_increment              |
| draft         | text             | YES  |     | NULL              |                             |
| activity_date | timestamp        | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
+---------------+------------------+------+-----+-------------------+-----------------------------+
3 rows in set (0.00 sec)

The draft field is a text string containing the stringafied JSON data object as shown below.

JSON Data Object

This object contains all of the information about a given draft except for the Draft ID.
It is stored in the table as a stringified json object called draft and appears to javascript as nested array.
The sample object below has just been created by logic on the draft1846Start page.

Click here to access a detailed description of this JSON Data Object

 
array (
  'status' => 'Pending',
  'updtCount' => 1,
  'numbPlayers' => 3,
  'curPlayer' => 1,
  'cpd' => 0,
  'deck' => 
  array (
    0 => 'Chicago and W. Indiana',
    1 => 'Blank Card',
    2 => 'Mail Contract',
    3 => 'Michigan Southern',
    4 => 'Ohio and Indiana',
    5 => 'Tunnel Blasting Co.',
    6 => 'Blank Card',
    7 => 'Blank Card',
    8 => 'Big 4',
  ),
  'hand' => 
  array (
  ),
  'players' => 
  array (
    0 => 
    array (
      'name' => 'rich3',
      'email' => 'richpri46@gmail.com',
      'confirmed' => 'No',
      'cash' => 400,
      'privates' => 
      array (
      ),
      'urlKey' => '00271U01D3ZC',
    ),
    1 => 
    array (
      'name' => 'rich2',
      'email' => 'richpri46@gmail.com',
      'confirmed' => 'No',
      'cash' => 400,
      'privates' => 
      array (
      ),
      'urlKey' => '00272X00VJ71',
    ),
    2 => 
    array (
      'name' => 'rich1',
      'email' => 'richpri46@gmail.com',
      'confirmed' => 'No',
      'cash' => 400,
      'privates' => 
      array (
      ),
      'urlKey' => '0027373K05DF',
    ),
  ),
)