Difference between revisions of "Design Document For DRAFT1846"

From BOARD18 Project WIKI
Jump to navigation Jump to search
(Some Fields of Note: completed 3 new fields)
m (JASON Data Object)
(6 intermediate revisions by the same user not shown)
Line 10: Line 10:
 
*[[Design Document Esthetics|Esthetics]]
 
*[[Design Document Esthetics|Esthetics]]
  
The diagram to the right shows the general control flow between the DRAFT1846 components. <br>
+
DRAFT1846 is a multi page email driven application. With two exceptions, emails are always used to pass control between pages.<br>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.
Note that many details have been omitted from this diagram.
+
 
 +
== DRAFT1846 Logic Flow ==
 +
The diagram to the right shows a simplified version of the control flow between the DRAFT1846 pages. <br>
 +
Note that though many details (and two pages) 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>
 +
Each such WIKI page list all of the functions contained in that DRAFT1846 page.
 +
 
 +
*[[ The index.html page for DRAFT1846]]
 +
*[[ The DRAFT1846Start Page]]
 +
*[[ The DRAFT1846Cfrm Page]]
 +
*[[ The DRAFT1846Next Page]]
 +
*[[ The DRAFT1846Last Page]]
 +
*[[ The DRAFT1846Goodby Page]]
 +
*[[ The DRAFT1846Com Page]]
 +
 
 +
== Database Structure ==
 +
The DRAFT1846 database is structured as follows:
 +
<pre>
 +
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)
 +
</pre>
 +
The draft field is a text string containing the stringafied JSON data object as shown below.
  
 
== JASON Data Object ==
 
== JASON Data Object ==
Line 17: Line 46:
 
<pre>  
 
<pre>  
 
array (
 
array (
   'status' => 'Active',
+
   'status' => 'Last',
   'updtCount' => 0,
+
   'updtCount' => 10,
   'numbPlayers' => 4,
+
   'numbPlayers' => 3,
   'curPlayer' => 1,
+
   'curPlayer' => 2,
 +
  'cpd' => 20,
 
   'deck' =>  
 
   'deck' =>  
 
   array (
 
   array (
    0 => 'Ohio and Indiana',
 
    1 => 'Michigan Central',
 
    2 => 'Meat Packing Co.',
 
    3 => 'Blank Card',
 
    4 => 'Mail Contract',
 
    5 => 'Big 4',
 
    6 => 'Tunnel Blasting Co.',
 
    7 => 'Blank Card',
 
    8 => 'Michigan Southern',
 
    9 => 'Blank Card',
 
    10 => 'Blank Card',
 
    11 => 'Chicago and W. Indiana',
 
 
   ),
 
   ),
 
   'hand' =>  
 
   'hand' =>  
 
   array (
 
   array (
 +
    0 => 'Mail Contract',
 
   ),
 
   ),
 
   'players' =>  
 
   'players' =>  
Line 43: Line 62:
 
     0 =>  
 
     0 =>  
 
     array (
 
     array (
       'name' => 'Paul',
+
       'name' => 'rich3',
       'email' => 'paul.zieske@gmail.com',
+
       'email' => 'richpri46@gmail.com',
 
       'confirmed' => 'Yes',
 
       'confirmed' => 'Yes',
       'cash' => 400,
+
       'cash' => 200,
 
       'privates' =>  
 
       'privates' =>  
 
       array (
 
       array (
 +
        0 => 'Tunnel Blasting Co.',
 +
        1 => 'Blank Card',
 +
        2 => 'Michigan Southern',
 
       ),
 
       ),
 
     ),
 
     ),
 
     1 =>  
 
     1 =>  
 
     array (
 
     array (
       'name' => 'Chris',
+
       'name' => 'rich2',
       'email' => 'garden.nomad@gmail.com',
+
       'email' => 'richpri46@gmail.com',
 
       'confirmed' => 'Yes',
 
       'confirmed' => 'Yes',
       'cash' => 400,
+
       'cash' => 240,
 
       'privates' =>  
 
       'privates' =>  
 
       array (
 
       array (
 +
        0 => 'Big 4',
 +
        1 => 'Chicago and W. Indiana',
 +
        2 => 'Blank Card',
 
       ),
 
       ),
 
     ),
 
     ),
 
     2 =>  
 
     2 =>  
 
     array (
 
     array (
       'name' => 'Rich',
+
       'name' => 'rich1',
       'email' => 'rich02@board18.org',
+
       'email' => 'richpri46@gmail.com',
 
       'confirmed' => 'Yes',
 
       'confirmed' => 'Yes',
       'cash' => 400,
+
       'cash' => 360,
      'privates' =>
 
      array (
 
      ),
 
    ),
 
    3 =>
 
    array (
 
      'name' => 'Frank',
 
      'email' => 'franktaw@netscape.net',
 
      'confirmed' => 'Yes',
 
      'cash' => 400,
 
 
       'privates' =>  
 
       'privates' =>  
 
       array (
 
       array (
 +
        0 => 'Ohio and Indiana',
 +
        1 => 'Blank Card',
 
       ),
 
       ),
 
     ),
 
     ),
Line 111: Line 128:
 
The actual value of the string is dependent on the php module in question and is documented there.
 
The actual value of the string is dependent on the php module in question and is documented there.
  
== Database Structure ==
 
The DRAFT1846 database is structured as follows:
 
<pre>
 
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)
 
</pre>
 
The draft field is a text string containing the stringafied JSON data object as shown above.
 
 
{{Stub}}
 
 
[[Category:Design]]
 
[[Category:Design]]

Revision as of 15:38, 18 May 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 (and two pages) 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.

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.

JASON Data Object

This Object contains all of the information about a given draft except for the Draft ID.

 
array (
  'status' => 'Last',
  'updtCount' => 10,
  'numbPlayers' => 3,
  'curPlayer' => 2,
  'cpd' => 20,
  'deck' => 
  array (
  ),
  'hand' => 
  array (
    0 => 'Mail Contract',
  ),
  'players' => 
  array (
    0 => 
    array (
      'name' => 'rich3',
      'email' => 'richpri46@gmail.com',
      'confirmed' => 'Yes',
      'cash' => 200,
      'privates' => 
      array (
        0 => 'Tunnel Blasting Co.',
        1 => 'Blank Card',
        2 => 'Michigan Southern',
      ),
    ),
    1 => 
    array (
      'name' => 'rich2',
      'email' => 'richpri46@gmail.com',
      'confirmed' => 'Yes',
      'cash' => 240,
      'privates' => 
      array (
        0 => 'Big 4',
        1 => 'Chicago and W. Indiana',
        2 => 'Blank Card',
      ),
    ),
    2 => 
    array (
      'name' => 'rich1',
      'email' => 'richpri46@gmail.com',
      'confirmed' => 'Yes',
      'cash' => 360,
      'privates' => 
      array (
        0 => 'Ohio and Indiana',
        1 => 'Blank Card',
      ),
    ),
  ),
  'return' => 'success',
)

Some Fields of Note

The "draft" database table field is a stringified JSON structure.
This structure contains some key/value pairs that could use some explanation as to their use.
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.
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 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 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.
The actual value of the string is dependent on the php module in question and is documented there.