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

+ week score v4

parent d353e507
......@@ -67,6 +67,7 @@
background-color: #49b785;
border-color: #49b785;
color: #ffffff;
left: 40%;
}
.container{
......
......@@ -163,22 +163,31 @@ var portal = {
function countingScore(){
////Расчет итогового количества часов происходит при нажатии кнопки сохранения
var table = portal.player.model.getModelWithId("ts_timesheet_table").getAsfData().findElement().data;;
var score = 0, monday = 0, tuesday = 0, wednesday = 0, thursday = 0, friday = 0, saturday = 0, sunday = 0;
for (var i = 10; i < table.length; i++){
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))
{
continue;
} else if(table[i].id == ("monday-b"+row)) { monday = table[i].value; score = Number.parseFloat(score) + Number.parseFloat(monday);}
else if (table[i].id == ("tuesday-b"+row)) { tuesday = table[i].value; score = Number.parseFloat(score) + Number.parseFloat(tuesday);}
else if (table[i].id == ("wednesday-b"+row)) { wednesday = table[i].value; score = Number.parseFloat(score) + Number.parseFloat(wednesday);}
else if (table[i].id == ("thursday-b"+row)) { thursday = table[i].value; score = Number.parseFloat(score) + Number.parseFloat(thursday);}
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);}
else if (table[i].id == ("sunday-b"+row)) { sunday = table[i].value; score = Number.parseFloat(score) + Number.parseFloat(sunday);}
}
portal.player.model.getModelWithId("ts_total_hours").setValue(score.toString());
var tsTable = portal.player.model.playerModel.getModelWithId('ts_timesheet_table');
var thModel = portal.player.model.playerModel.getModelWithId('ts_total_hours');
var days = {'monday': 0, 'tuesday': 0, 'wednesday': 0, 'thursday': 0, 'friday': 0, 'saturday': 0, 'sunday': 0};;
for(var i in days) {
tsTable.modelBlocks.forEach(function(modelBlock) {
modelBlock.forEach(function (m) {
if (m.asfProperty.id === i) {
var n = parseFloat(m.getValue());
if(_.isNaN(n)){
n = 0;
}
days[i] = days[i] + n;
}
});
});
}
var totalHours = 0;
for(var n in days) {
totalHours += days[n];
jQuery('#ts_timesheet_table_total_'+n).text(days[n]);
}
thModel.setValue(totalHours.toString());
};
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