Commit 8717250d authored by Alina Habibulina's avatar Alina Habibulina

+ week score v4

parent d353e507
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
background-color: #49b785; background-color: #49b785;
border-color: #49b785; border-color: #49b785;
color: #ffffff; color: #ffffff;
left: 40%;
} }
.container{ .container{
......
...@@ -163,22 +163,31 @@ var portal = { ...@@ -163,22 +163,31 @@ var portal = {
function countingScore(){ function countingScore(){
////Расчет итогового количества часов происходит при нажатии кнопки сохранения ////Расчет итогового количества часов происходит при нажатии кнопки сохранения
var table = portal.player.model.getModelWithId("ts_timesheet_table").getAsfData().findElement().data;; var tsTable = portal.player.model.playerModel.getModelWithId('ts_timesheet_table');
var score = 0, monday = 0, tuesday = 0, wednesday = 0, thursday = 0, friday = 0, saturday = 0, sunday = 0; var thModel = portal.player.model.playerModel.getModelWithId('ts_total_hours');
for (var i = 10; i < table.length; i++){ var days = {'monday': 0, 'tuesday': 0, 'wednesday': 0, 'thursday': 0, 'friday': 0, 'saturday': 0, 'sunday': 0};;
var row = Number.parseInt(i/10);
if(table[i].id == ("project-b"+row) || table[i].id == ("task-b"+row) || table[i].id == ("result-b"+row)) for(var i in days) {
{ tsTable.modelBlocks.forEach(function(modelBlock) {
continue; modelBlock.forEach(function (m) {
} else if(table[i].id == ("monday-b"+row)) { monday = table[i].value; score = Number.parseFloat(score) + Number.parseFloat(monday);} if (m.asfProperty.id === i) {
else if (table[i].id == ("tuesday-b"+row)) { tuesday = table[i].value; score = Number.parseFloat(score) + Number.parseFloat(tuesday);} var n = parseFloat(m.getValue());
else if (table[i].id == ("wednesday-b"+row)) { wednesday = table[i].value; score = Number.parseFloat(score) + Number.parseFloat(wednesday);} if(_.isNaN(n)){
else if (table[i].id == ("thursday-b"+row)) { thursday = table[i].value; score = Number.parseFloat(score) + Number.parseFloat(thursday);} n = 0;
else if (table[i].id == ("friday-b"+row)) { friday = table[i].value; score = Number.parseFloat(score) + Number.parseFloat(friday);} }
else if (table[i].id == ("saturday-b"+row)) { saturday = table[i].value; score = Number.parseFloat(score) + Number.parseFloat(saturday);} days[i] = days[i] + n;
else if (table[i].id == ("sunday-b"+row)) { sunday = table[i].value; score = Number.parseFloat(score) + Number.parseFloat(sunday);} }
});
});
}
var totalHours = 0;
for(var n in days) {
totalHours += days[n];
jQuery('#ts_timesheet_table_total_'+n).text(days[n]);
} }
portal.player.model.getModelWithId("ts_total_hours").setValue(score.toString());
thModel.setValue(totalHours.toString());
}; };
function timeComputing(serverDateTime){ function timeComputing(serverDateTime){
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment