Refactor watering scale logic flow
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { GeoCoordinates, WateringData } from "../../types";
|
||||
import { BaseWateringData, GeoCoordinates } from "../../types";
|
||||
import { WeatherProvider } from "../weatherProviders/WeatherProvider";
|
||||
|
||||
|
||||
@@ -7,10 +7,8 @@ export interface AdjustmentMethod {
|
||||
* Calculates the percentage that should be used to scale watering time.
|
||||
* @param adjustmentOptions The user-specified options for the calculation. No checks will be made to ensure the
|
||||
* AdjustmentOptions are the correct type that the function is expecting or to ensure that any of its fields are valid.
|
||||
* @param wateringData The basic weather information of the watering site. This may be undefined if an error occurred
|
||||
* while retrieving the data.
|
||||
* @param coordinates The coordinates of the watering site.
|
||||
* @param weatherProvider The WeatherProvider that should be used if the adjustment method needs to obtain any more
|
||||
* @param weatherProvider The WeatherProvider that should be used if the adjustment method needs to obtain any
|
||||
* weather data.
|
||||
* @return A Promise that will be resolved with the result of the calculation, or rejected with an error message if
|
||||
* the watering scale cannot be calculated.
|
||||
@@ -18,7 +16,6 @@ export interface AdjustmentMethod {
|
||||
*/
|
||||
calculateWateringScale(
|
||||
adjustmentOptions: AdjustmentOptions,
|
||||
wateringData: WateringData | undefined,
|
||||
coordinates: GeoCoordinates,
|
||||
weatherProvider: WeatherProvider
|
||||
): Promise< AdjustmentMethodResponse >;
|
||||
@@ -52,6 +49,8 @@ export interface AdjustmentMethodResponse {
|
||||
* user-configured watering scale instead of using the one returned by the AdjustmentMethod.
|
||||
*/
|
||||
errorMessage?: string;
|
||||
/** The data that was used to calculate the watering scale, or undefined if no data was used. */
|
||||
wateringData: BaseWateringData;
|
||||
}
|
||||
|
||||
export interface AdjustmentOptions {}
|
||||
|
||||
Reference in New Issue
Block a user