Ejemplo n.º 1
0
        private async Task <Reading <decimal> > PrepareRainfallReading(Task <List <Document> > queryResult,
                                                                       string stationId)
        {
            var reducedScanResult = await GetReducedScanResult(queryResult);

            return(ReadingFactory.BuildReading(stationId, reducedScanResult));
        }
Ejemplo n.º 2
0
        private async Task <Reading <decimal> > PrepareInsideTempReading(Task <List <Document> > queryResult)
        {
            List <IMeasurement <decimal> > reducedScanResult = new List <IMeasurement <decimal> >();

            foreach (var d in await queryResult)
            {
                var temp           = decimal.Parse(d["inside-temp"], _culture);
                var convertedTemp  = (temp - 32) * 5 / 9;
                var readingDate    = DateTime.Parse(d["timestamp"], _culture);
                var dateTimeOffset = new DateTimeOffset(readingDate);
                var unixDateTime   = dateTimeOffset.ToUnixTimeSeconds();

                reducedScanResult.Add(new Measurement <decimal>(
                                          readingDate, unixDateTime, convertedTemp
                                          ));
            }

            return(ReadingFactory.BuildReading("InsideTemperature", reducedScanResult));
        }