4800-v-007-001
[previously]
- [REFERENCE] prj4800
- ] # # - plan - overview
- ] # # - document -
- [2015-06-24]
- ] # # -
- [00:00] NEW task IN DATA
- +] # 340 - driver joe nemechek
- [2015-06-25][00:00] NEW task IN
- x] ADD - .costThisRace - to each driver record, ,"costThisRace":"5.00"
- *] used VALUES for sonoma race
- *] ENTERED VALUES for michigan race in sheet
- [2015-06-25] NEW task IN FIX-PRB
- ] FIX-PRB# # - no longer writing file
- ] revert to old code
- ] rem out - loop - process data, x] File writes
- [00:00] NEW task IN FIX-PRB# #
- x] TRY = CHECK data - x] found 4 records, no field added ( nemechek, r.blaney, moffitt, bliss ), x] added field, x] changed status to "asked" *] set value of cTR=4.00 which is NOT valid,
- *] should work/test with small tight data sets)
- x] TRY = return loop to code
- x] RESULT = no change
- [00:00] NEW task IN FIX-PRB
- x] TRY = rem out new line for "costThisRace"
- x] RESULT = no change
- *] UPDATE DATA change = truex jr missing "practiceF" value, added set val=10 (not actual)
- [00:00] NEW task IN BREAKDOWN
- i] breakdown createRankings1() FROM: 1 big process TO: several smaller processes
- ] breakdown into 1 big process INTO ] saveEntrants w/AvgFinish aka rankings-1 ] saveQualified aka-rankings-2, ] saveLastPractice, --> ] saveFinal
- [00:00] NEW task IN FIX-PRB - prb loc in loop, prj line eval
- x] TRY = rem just the eval line in the loop
- x] RESULT = CAUSE - this appears to be the problem, ? = why did it work before
- x] TRY = instead of processing the whole data set (driRank.length), just do a few
- x] RESULT = 10 - still broke, 5 = works, 6 = FAIL, PRB = record 5
- x] record 5 = PRB id.team=14 - had a bunch of new line char's in the json
- x] record 6 = PRB id.team=22 - extra comma,
- x] SOLUTION = problem WAS NOT in code, PRB was in DATA, bad data broke the code, (REMEMBER how sensitive js is)
- *] deprecated = home.js-v-006
- [14:00] NEW task
- x] deprecate = home.js-v-007 - cleaned out greenspace, ] should REVIEW code try/fail/... for project notes(lrn node,pass)
- [15:00] NEW task IN BREAKDOWN
- x] split into createRankings1() into 3 functions createRankings1, createRankings2, createRankings3,
- x] all write file, but different file,
- x] incrementally increase data fields,+qualified, +finalP, +costThisRace, 2 and 3 do the same processing as 1
- x] REMOVED driverRank from inside function, to outside(global)
- [16:00] NEW task IN FIX PRB
- x] accidentally deleted a closing bracket, toss another hour into the sea :(
- >> [17:00] NEW task IN ADD makeSelections(idx) - a recursive function to select best picks
- i] # # - CREATE-function - makeSelection(availBudget) - recursive function to keep making selections(based upon availBudget) until roster is set
- x] SUCCESS ] function is executing, ] function is executing the correct # of times BUT
- i] PRB function is not accessing arrary vars in driverRankings
- ] ADD conditons, budget,
- x] TRY= move call to function inside of createRankingsFile, this should give access to local var driRanks, PASS driRank as arg
- x] RESULT = FAIL
- [18:00] NEW task IN
- x] # # - CREATE-function - makeSelections2(array)
- x] iterate array, ] pick form top (passed array has been sorted by points)
- x] push into selections array
- x] budget, budgetBalance, balance = budget - selection;
- x] ADD condition, - dont push selection unless budget ( if arr[i].cost < budget){select, adjust budget} )
- *] cur result pick# 5 (kenseth) puts selections over budget,
- x] deprecated home-v-008
- [2015-06-27] NEW task IN
- i] # # - UPDATE-function -createRankings2, ADD selections code
- x] makeSelections2 IS functional, currently using "Rankings1"
- ] ADD functionality: TO:call makeSelections(), call raceStatusChanged() x] createRankings- 2, x] 3/final -
- ] change initial CALL to createRankings1, to createRankings2,
- ] PRB = writing file but no content, , rankings page display info
- ] CAUSE = calling raceStatusChange immediately after filewrite op must break filewrite, creates file but has no content
- ] RESOLUTION/WORKAROUND - move call to raceStatusChange back to orig location
- *] use curRace.setStatus <> raceStatusChanged()
- [00:00] NEW task IN
- i] # # - UPDATE-function -createRankings3, ADD selections code
- *] REM saveFile rankings3
- *] PRB - selections top 4 drivers max out budget, no fifth selection
[currently]
- ]
[next]
- [00:00] NEW task IN
- ] # # - 007-002 DATA for race# 16
- [00:00] NEW task IN
- ] # # - FIX-PRB selections - picking only 4 drivers
[] selections - recursion
> write loop to do something
- example multiple num * by 10
> put loop into function ( pass in arg)
>> CREATE - article# 5327 recursion - javascript
[] selection
return driver.rankPoints where driver.costThisRace <= budget.balance
selections = selections + 1;
> function getDriverWithMostPoints( budgetBalance){
for (i=0;i<rankings.length;i++){
selections = selections + 1;
// return rankings[0].name;
return i;
budgetBalance = budget - rankings[0].costRace
}
> function getSelections(){
while (selections < 4) {
selections++;
getDriverWithMostPoints(budgetBalance);
}
}
> function checkBudget()
for (i=, i<=, i++){
}
list of drivers, drivers have been ranked with points to determine which are the best choices, each driver also has a cost between 5-30, typically the drivers with the highest rankings have the highest cost
NEED = to pick 5 drivers, WANT = the 5 best drivers(most points)
BUT = i only have budget of $100 to spend on all 5 driver
AND = i must have 5 drivers on my driver roster
manually i would
- select top ranked driver , - add to list, -subtract cost from budget
- select 2 ranked driver, - add to list, - sub d
- select 3rd ranked driver, - add to list, subract driver.costRace from budget
( at this point, HAVE = i will have 3 selections, likely have used about 80-90 $/% of my budget
NEED = make to make 2 more selections, most points for ( budgetBalance$ )
BUT = function getDriverWithMostPoints will return a driver AND NOT LEAVE enough $ to make the final selection
- cheapestDriver =
2015-06-27 to the remote server.
11:56:14 AM: Updating file (nascar.sospep.com\2015-15-rankings-1.json).
11:56:14 AM: Updating file (nascar.sospep.com\2015-15-rankings-2.json).
11:56:14 AM: Updating file (nascar.sospep.com\2015-15-rankings-3.json).
11:56:14 AM: Updating file (nascar.sospep.com\2015-15-rankings-final.json).
11:56:14 AM: Updating file (nascar.sospep.com\routes\home.js).
11:56:14 AM: Updating file (nascar.sospep.com\views\rankings.jade).
11:56:14 AM: Publish completed.