added cost prediction for harald ;)
This commit is contained in:
parent
7d086f4b36
commit
738c4fcd42
2 changed files with 10 additions and 10 deletions
|
@ -192,17 +192,13 @@ Entity.prototype.getRow = function() {
|
|||
};
|
||||
|
||||
Entity.prototype.loadData = function() {
|
||||
//var delta = vz.options.plot.xaxis.max - vz.options.plot.xaxis.min;
|
||||
//var offset = delta * 0.1;
|
||||
var offset = 1000*30*60; // load additional data to avoid paddings
|
||||
|
||||
return vz.load({
|
||||
controller: 'data',
|
||||
identifier: this.uuid,
|
||||
context: this,
|
||||
data: {
|
||||
from: Math.floor(vz.options.plot.xaxis.min - offset), // TODO fuzy-logic to get enough data
|
||||
to: Math.ceil(vz.options.plot.xaxis.max + offset),
|
||||
from: Math.floor(vz.options.plot.xaxis.min),
|
||||
to: Math.ceil(vz.options.plot.xaxis.max),
|
||||
tuples: vz.options.tuples
|
||||
},
|
||||
success: function(json) {
|
||||
|
@ -231,7 +227,11 @@ Entity.prototype.loadData = function() {
|
|||
);
|
||||
}
|
||||
if (this.cost !== undefined) {
|
||||
$('#entity-' + this.uuid + ' .cost').text(vz.wui.formatNumber(this.cost * this.data.consumption) + ' €');
|
||||
var delta = this.data.to - this.data.from;
|
||||
|
||||
$('#entity-' + this.uuid + ' .cost')
|
||||
.text(vz.wui.formatNumber(this.cost * this.data.consumption) + ' €')
|
||||
.attr(vz.wui.formatNumber(this.cost * this.data.consumption * (60*60*24*265/delta)));
|
||||
}
|
||||
}
|
||||
else { // no data available, clear table
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* @author Florian Ziegler <fz@f10-home.de>
|
||||
* @author Justin Otherguy <justin@justinotherguy.org>
|
||||
* @author Steffen Vogel <info@steffenvogel.de>
|
||||
* @copyright Copyright (c) 2010, The volkszaehler.org project
|
||||
* @copyright Copyright (c) 2011, The volkszaehler.org project
|
||||
* @package default
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*/
|
||||
|
@ -31,8 +31,8 @@
|
|||
$.extend( {
|
||||
getUrlParams : function() {
|
||||
var vars = {}, hash;
|
||||
var hashes = window.location.href.slice(
|
||||
window.location.href.indexOf('?') + 1).split('&');
|
||||
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
||||
|
||||
for (var i = 0; i < hashes.length; i++) {
|
||||
hash = hashes[i].split('=');
|
||||
switch (typeof vars[hash[0]]) {
|
||||
|
|
Loading…
Add table
Reference in a new issue