Add task.history = [], updated on cron. this will be used for charts later

This commit is contained in:
Tyler Renelle 2012-06-28 21:22:24 -04:00
parent d4aee014b0
commit 18e8472099
2 changed files with 12 additions and 4 deletions

View file

@ -125,6 +125,8 @@ endOfDayTally = (model) ->
unless completed
value += if (value < 0) then (( -0.1 * value + 1 ) * -1) else (( Math.pow(0.9,value) ) * -1)
task.set('value', value)
task.setNull 'history', []
task.push "history", { date: new Date(), value: value }
# Deduct experience for missed Daily tasks,
# but not for Todos (just increase todo's value)
if (type == 'daily')

View file

@ -156,9 +156,17 @@
</label>
</div>
{/}
<button type=submit class="btn">Save</a>
<button x-bind=click:del class="btn btn-danger">Delete</a>
<button type=submit class="btn">Save</button>
<button x-bind=click:del class="btn btn-danger">Delete</button>
</form>
<div id="{:task.id}-chart">
{#each :task.history}
Date:<div>{date}</div>
Value:<div>{value}</div>
{/}
</div>
</div>
<Footer:>
@ -174,5 +182,3 @@
<script src=/jquery.min.js></script>
<script src=/jquery-ui.min.js></script>
<script src=/bootstrap.min.js></script>