Begin refactoring to TypeScript

This commit is contained in:
Matthew Oslan
2019-05-09 00:55:37 -04:00
parent 39a58a9f91
commit 6acb40eed1
6 changed files with 135 additions and 4 deletions

4
routes/weather.js → routes/weather.ts Executable file → Normal file
View File

@@ -192,7 +192,7 @@ function calculateWeatherScale( adjustmentMethod, adjustmentOptions, weather ) {
}
// Apply all of the weather modifying factors and clamp the result between 0 and 200%.
return parseInt( Math.min( Math.max( 0, 100 + humidityFactor + tempFactor + precipFactor ), 200 ) );
return Math.floor( Math.min( Math.max( 0, 100 + humidityFactor + tempFactor + precipFactor ), 200 ) );
}
return -1;
@@ -305,7 +305,7 @@ exports.getWateringData = function( req, res ) {
var data = {
scale: scale,
rd: rainDelay,
tz: getTimezone( weather.timezone ),
tz: getTimezone( weather.timezone, undefined ),
sunrise: weather.sunrise,
sunset: weather.sunset,
eip: ipToInt( remoteAddress ),