edit-task
Home
Up
Delete
Task Name:
Task Description:
] UPDATE PAGE selections - display drivers data(name, ...) for "my selections",
TaskGroup ID:
Start Date:
Start Time:
Duration:
Priority:
Status:
To Do
Completed
In Process
Add Photo:
Owner ID:
Content:
use HTML
Edit Content
<h1 style="text-align: center;">4800-v-003-002</h1> <h1 style="text-align: center;">selections - display drivers name</h1> <h2>[previously]</h2> <ol> <li><strong>] PAGE selections </strong></li> <ol> <li>*] GOAL - display "drivers names" correctly with driver name</li> <li>] currently pulling teamID's from the array "selections" in route/index.js</li> <li>x] have to pass 'selections' into the 'view' from </li> <li>x] have to pass 'drivers' into view</li> </ol></ol> <h2>[currently]</h2> <ol> <li><strong>[2015-06-06] NEW task IN outline </strong></li> <ol> <li>x] ADD manually - team_id field - ] to all drivers entries in drivers.json</li> <li>] CREATE - "lookup" function - driver by team id<strong> -</strong>{ return indexOf.drivers(teamID) } the index of the driver in the array of driver objects, which would enable us to pull the drivers data</li> <li>x] CREATE - selections.js // model - seperate file for MODEL view</li> <li>x] add function 'lookupDriver' to </li> <li>?] add requires = ./drivers.json</li> <li>] PRB - PG inline script does NOT have access to the passed in values ] - the view can access to the data that "routes/.." passed into it ( ex drivers) </li> <li>*] inline script can call function in "linked" script, ex inline function callLinked(drivers){//doStuff}</li> <li>x] </li> <li>x] TRY = pass string into function in .js file works</li> </ol> <li><strong>[00:00</strong><strong>] NEW task IN PAGE drivers.json</strong></li> <ol> <li>] # # ADD manually - team_id field - to all drivers entries in drivers.json</li> </ol> <li><strong>[00:00</strong><strong>] NEW task IN PAGE routes/index</strong></li> <ol> <li>] # # - CREATE - "lookup" function - driver by team id -</li> <li>] { return indexOf.drivers(teamID) }</li> <li>] the index of the driver in the array of driver objects, which would enable us to pull the drivers data</li> </ol> <li><strong>> [00:00</strong><strong>] NEW task IN PAGE selections.js</strong></li> <ol> <li>] # # CREATE PAGE- selections.js // model - a seperate file for the MODEL || viewModel (data, we need to construct the view, METHODS to operate on data )</li> <li>x] link the script in the view -</li> <li>*] NOT using b/c PRB cant seem to access the data that is passed into the view from the scripts in this file</li> <li>?] add requires = ./drivers.json</li> </ol> <li><strong>[00:00</strong><strong>] NEW task IN PAGE selections.js</strong></li> <ol> <li><strong>] # # - PRB - can't access data</strong></li> <li>] view has access to the data that "routes/selections" passed into it ( ex drivers) BUT ] PRB -</li> <li>] PG inline script does NOT have access to the passed in values </li> <li>*] inline script can call "linked" script, ex inline function callLinked(drivers){//doStuff}</li> <li>x] TRY = pass string into function in .js file works</li> </ol> <li><strong>*</strong><strong>[00:00</strong><strong>] NEW task IN PAGE routes/index.js</strong></li> <ol> <li><strong>] # # - WORKAROUND</strong> - x] use route/index - app.get(/selections) - build data for page in this file, then pass data into the view - this works fine but this file would become a huge messy beast after some time</li> </ol> <li><strong>[00:00</strong><strong>] NEW task IN PAGE routes/index.js</strong></li> <ol> <li><strong>] # # - ADD property to teams[] object, </strong>- x] added field 'driverIndex', use this to store a reference to the drivers information in the</li> <li><span style="background-color: #ffff00;">?] WHAT IF -</span> drivers table changes, aka someone deletes a driver record</li> </ol> <li><strong>[00:00] NEW task IN PAGE routes/index.js </strong></li> <ol> <li><strong>] # # - UPDATE lookup function - </strong>x] use code to find "key" "value" in an arrary of javascript objects</li> <li>x] findIndexOf(arraryToSearch, "key", "value")</li> <ol> <li>] where key is is field you want to search on, value is the value you want to match</li> <li>] EXAMPLE = findIndexOf(drivers,"teamID", "48") </li> </ol> <li>] drivers[teams[index].driverIndex].name</li> <li>] REF = # <a href="/view/article?id=4562" target="_blank">4562 - javascript-how-to-lookup-index-of-object</a></li> </ol> <li><strong>[2015-06-07][00:00] PUBLISH</strong><ol> <li>x] route/index selections x] selections.jade *] javascript/selections.js, x] drivers.json</li> </ol></li> </ol> <h2>[next]</h2> <ol> <li><strong>[2015-06-07]i] # 5246 - 4800-v-003-002-selections - UPDATE display drivers name</strong></li> <ol> <li>] TEST - requires drivers, different paths, no change,</li> <li>] HAVE = selections.drivers[5] - contains teamID</li> <li>] HAVE = teams [id:17 driverID:223], NEED- lookup ] get driverID, ] lookup driverName in</li> <li>>] HAVE*= drivers[id: ,name: ,teamID - NEED - lookup</li> <ol> <li>] do in route?controller - pass into view</li> <li>] inline script in view</li> <li>] linked script in view (PRB passing data to )</li> </ol></ol> <li><span style="text-decoration: line-through;">] drivers[teams[index].driverID].name</span></li> </ol> <p> [format]</p> <ol> <li><strong>] PAGE route/index</strong></li> <ol> <li>] DEFINE object</li> <li>] CREATE function - buildMenuMain()</li> <li>] PASS object 'menuMain' into /view/*</li> </ol> <li><strong>] UPDATE PAGE view/index</strong></li> <ol> <li>]</li> </ol> <li><strong>] TEST 4800-v-003-selections-display-drivers-name</strong></li> <ol> <li>]</li> </ol></ol> <p> </p> <p> </p>