Ei muokkausyhteenvetoa |
Ei muokkausyhteenvetoa |
||
| Rivi 44: | Rivi 44: | ||
for ( var ot in jw.obstype ) { | for ( var ot in jw.obstype ) { | ||
for ( var oi in jw.obstype[ ot ].obses ) { | |||
//use just the most recent from level obses | |||
if ( ot == 'level' ) { jw.obstype[ ot ].obses.splice(1); } | |||
for ( var oi in jw.obstype[ ot ].obses ) { | |||
o = jw.obstype[ ot ].obses[ oi ]; | o = jw.obstype[ ot ].obses[ oi ]; | ||
obs = jw.obs[ o ]; | obs = jw.obs[ o ]; | ||
| Rivi 77: | Rivi 81: | ||
} | } | ||
} | } | ||
jw.obstype[ ot ].sum += data.val / days; | if ( ot == 'level' ) { | ||
if ( typeof data.inreltodateavg != 'undefined' ) { | |||
jw.obstype[ot].mean = data.inreltodateavg; | |||
} else if ( typeof data.inreltomwl != 'undefined' ) { | |||
jw.obstype[ot].mean = data.inreltomwl; | |||
} else { | |||
jw.obstype[ot].mean = null; | |||
} | |||
} else { | |||
jw.obstype[ ot ].sum += data.val / days; | |||
jw.obstype[ ot ].count = jw.obstype[ ot ].count + 1/days; | |||
jw.obstype[ ot ].mean = jw.obstype[ ot ].sum / jw.obstype[ ot ].count; | |||
} | |||
} | } | ||


