remove plants from default criteria

pull/1732/head
gabrielburnworth 2020-03-17 08:34:32 -07:00
parent 85be07efe5
commit 309737dd33
3 changed files with 6 additions and 5 deletions

View File

@ -1,7 +1,7 @@
import { every, get, uniq, gt, lt, isNumber } from "lodash";
import { every, get, uniq, gt, lt, isNumber, isEqual } from "lodash";
import { TaggedPoint, TaggedPointGroup } from "farmbot";
import moment from "moment";
import { PointGroupCriteria } from "./interfaces";
import { PointGroupCriteria, DEFAULT_CRITERIA } from "./interfaces";
/** Check if a string or number criteria field is empty. */
const eqCriteriaEmpty =
@ -45,6 +45,7 @@ export const selectPointsByCriteria = (
allPoints: TaggedPoint[],
now = moment(),
): TaggedPoint[] => {
if (isEqual(criteria, DEFAULT_CRITERIA)) { return []; }
const check = checkCriteria(criteria, now);
return allPoints.filter(point =>
every(Object.keys(criteria).map((key: keyof PointGroupCriteria) =>

View File

@ -15,7 +15,7 @@ export const DEFAULT_CRITERIA: Readonly<PointGroupCriteria> = {
number_eq: {},
number_gt: {},
number_lt: {},
string_eq: { pointer_type: ["Plant"] },
string_eq: {},
};
export interface GroupCriteriaProps {

View File

@ -83,8 +83,8 @@ export const NumberCriteriaSelection = (props: NumberCriteriaProps) => {
};
const DAY_OPERATOR_DDI_LOOKUP = (): { [x: string]: DropDownItem } => ({
["<"]: { label: t("less than"), value: "<" },
[">"]: { label: t("greater than"), value: ">" },
["<"]: { label: t("Less than"), value: "<" },
[">"]: { label: t("Greater than"), value: ">" },
});
/** Edit and view day criteria. */