Changeset 9125727


Ignore:
Timestamp:
11/20/2014 10:51:40 PM (10 years ago)
Author:
njw <njw@…>
Branches:
master
Children:
adb0f52
Parents:
4fd0ab9
Message:

Corrected calculation of year consumption

File:
1 edited

Legend:

Unmodified
Added
Removed
  • de.wigbels.ruby/hothotwrite/hhw.rb

    r4fd0ab9 r9125727  
    5353    log.info("Inserted sensor: #{sensorid} with data: #{data}")
    5454  else
     55    years = dbh.query( %Q"select count(distinct year(measuredat)) FROM sensor" )
     56    put years
    5557    # Auswertung Gesamtes Jahr, Monat, Vergleich Vorjahr
    5658    myquery = %Q{ select sum(data), 'Liter Verbrauch in #{month}-#{logyear}' \
     
    7072                  where year(measuredat) = '#{yearbefore}'
    7173                  union
    72                   select truncate(avg(data),2), 'Durchschnittsverbrauch Gesamtjahr Liter/Tag' \
     74                  select truncate(avg(data)/#{years},2), 'Durchschnittsverbrauch Gesamtjahr Liter/Tag' \
    7375                  from \
    7476                    (select sum(data) as data from sensor \
     
    7678                  as foo
    7779                  union
    78                   select truncate(avg(data),2), 'Durchschnittsverbrauch Sommmer Liter/Tag' \
     80                  select truncate(avg(data)/#{years},2), 'Durchschnittsverbrauch Sommmer Liter/Tag' \
    7981                  from \
    8082                    (select sum(data) as data from sensor \
     
    8385                  as foo
    8486                  union
    85                   select truncate(avg(data),2), 'Durchschnittsverbrauch Winter Liter/Tag' \
     87                  select truncate(avg(data)/#{years},2), 'Durchschnittsverbrauch Winter Liter/Tag' \
    8688                  from \
    8789                    (select sum(data) as data from sensor \
Note: See TracChangeset for help on using the changeset viewer.