Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Show current sum of hours on load
  • Loading branch information
BenMQ committed Nov 7, 2014
commit 16153303cbe881247a797bf06cc9020f0e5418fb
14 changes: 13 additions & 1 deletion claims/claim-cs1010s.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,20 @@ function Claim(config) {
var a = activities[i];
this.activities_list.push(createActivity(a.activity_type, a.week, a.day, a.start_time, a.end_time));
}

// sum up existing hours claimed
var $existing_claims = $('#claim-info-div table tr');
var existing_hours = 0;
$existing_claims.each(function(){
var row = $(this);
if (row.find('input[name=action]').val() === 'DELETE') {
var hours = parseFloat(row.find('td:eq(5)').text());
if (!isNaN(hours)) {
existing_hours += hours;
}
}
})
this.ajax_index = 0; // index to keep track of the current ajax call
console.log('Current hours claimed: ' + existing_hours);
console.log('Claim object successfully created. Run c.makeAllClaims() to start.');
}

Expand Down
14 changes: 13 additions & 1 deletion claims/claim-cs3217.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,20 @@ function Claim(config) {
var a = activities[i];
this.activities_list.push(createActivity(a.activity_type, a.week, a.day, a.start_time, a.end_time));
}

// sum up existing hours claimed
var $existing_claims = $('#claim-info-div table tr');
var existing_hours = 0;
$existing_claims.each(function(){
var row = $(this);
if (row.find('input[name=action]').val() === 'DELETE') {
var hours = parseFloat(row.find('td:eq(5)').text());
if (!isNaN(hours)) {
existing_hours += hours;
}
}
})
this.ajax_index = 0; // index to keep track of the current ajax call
console.log('Current hours claimed: ' + existing_hours);
console.log('Claim object successfully created. Run c.makeAllClaims() to start.');
}

Expand Down
14 changes: 13 additions & 1 deletion claims/claim.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,20 @@ function Claim(config) {
var a = activities[i];
this.activities_list.push(createActivity(a.activity_type, a.week, a.day, a.start_time, a.end_time));
}

// sum up existing hours claimed
var $existing_claims = $('#claim-info-div table tr');
var existing_hours = 0;
$existing_claims.each(function(){
var row = $(this);
if (row.find('input[name=action]').val() === 'DELETE') {
var hours = parseFloat(row.find('td:eq(5)').text());
if (!isNaN(hours)) {
existing_hours += hours;
}
}
})
this.ajax_index = 0; // index to keep track of the current ajax call
console.log('Current hours claimed: ' + existing_hours);
console.log('Claim object successfully created. Run c.makeAllClaims() to start.');
}

Expand Down