Add default implementations to WeatherProvider

This commit is contained in:
Matthew Oslan
2019-06-06 16:17:06 -04:00
parent 8368991c67
commit b57b019295
2 changed files with 10 additions and 14 deletions

View File

@@ -184,11 +184,6 @@ function checkWeatherRestriction( adjustmentValue: number, weather: WateringData
export const getWeatherData = async function( req: express.Request, res: express.Response ) {
const location: string = getParameter(req.query.loc);
if ( !weatherProvider.getWeatherData ) {
res.send( "Error: selected WeatherProvider does not support getWeatherData" );
return;
}
let coordinates: GeoCoordinates;
try {
coordinates = await resolveCoordinates( location );
@@ -263,11 +258,6 @@ export const getWateringData = async function( req: express.Request, res: expres
let timeData: TimeData = getTimeData( coordinates );
let wateringData: WateringData;
if ( adjustmentMethod !== ADJUSTMENT_METHOD.MANUAL || checkRestrictions ) {
if ( !weatherProvider.getWateringData ) {
res.send( "Error: selected WeatherProvider does not support getWateringData" );
return;
}
try {
wateringData = await weatherProvider.getWateringData( coordinates );
} catch ( err ) {