fixed last bit of math filtertype
This commit is contained in:
parent
9baa980df6
commit
9945cba323
4 changed files with 23 additions and 15 deletions
|
@ -12,7 +12,7 @@ type Filter struct {
|
|||
Name string `form:"filter_name" yaml:"filter_name" json:"filter_name" binding:"required" validate:"min=1"`
|
||||
X int `form:"x" yaml:"x" json:"x" validate:"default=0"`
|
||||
Y int `form:"y" yaml:"y" json:"y" validate:"default=0"`
|
||||
Type string `form:"filter_type" yaml:"filter_type" json:"filter_type" binding:"required" validate:"oneof=url xpath json css replace match substring min max average count"`
|
||||
Type string `form:"filter_type" yaml:"filter_type" json:"filter_type" binding:"required" validate:"oneof=url xpath json css replace match substring math"`
|
||||
Var1 string `form:"var1" yaml:"var1" json:"var1" binding:"required"`
|
||||
Var2 *string `form:"var2" yaml:"var2" json:"var2"`
|
||||
Var3 *string `form:"var3" yaml:"var3" json:"var3"`
|
||||
|
|
34
scraping.go
34
scraping.go
|
@ -72,22 +72,28 @@ func getFilterResult(filter *Filter) {
|
|||
{
|
||||
getFilterResultSubstring(filter)
|
||||
}
|
||||
case filter.Type == "min":
|
||||
case filter.Type == "math":
|
||||
{
|
||||
getFilterResultMin(filter)
|
||||
}
|
||||
case filter.Type == "max":
|
||||
{
|
||||
getFilterResultMax(filter)
|
||||
}
|
||||
case filter.Type == "average":
|
||||
{
|
||||
getFilterResultAverage(filter)
|
||||
}
|
||||
case filter.Type == "count":
|
||||
{
|
||||
getFilterResultCount(filter)
|
||||
switch {
|
||||
case filter.Var1 == "min":
|
||||
{
|
||||
getFilterResultMin(filter)
|
||||
}
|
||||
case filter.Var1 == "max":
|
||||
{
|
||||
getFilterResultMax(filter)
|
||||
}
|
||||
case filter.Var1 == "average":
|
||||
{
|
||||
getFilterResultAverage(filter)
|
||||
}
|
||||
case filter.Var1 == "count":
|
||||
{
|
||||
getFilterResultCount(filter)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
log.Println("getFilterResult called with filter.Type == ", filter.Type)
|
||||
}
|
||||
|
|
|
@ -279,6 +279,7 @@ function onTypeChange(node) {
|
|||
}
|
||||
case "math": {
|
||||
var mathSelect = document.createElement("select");
|
||||
mathSelect.name = "var1";
|
||||
mathSelect.id = "var1Input";
|
||||
mathSelect.classList.add("form-control");
|
||||
var mathOptionMin = document.createElement("option");
|
||||
|
|
|
@ -268,6 +268,7 @@ function onTypeChange(node: DiagramNode | null = null){
|
|||
}
|
||||
case "math": {
|
||||
let mathSelect = document.createElement("select");
|
||||
mathSelect.name = "var1";
|
||||
mathSelect.id = "var1Input";
|
||||
mathSelect.classList.add("form-control");
|
||||
let mathOptionMin = document.createElement("option");
|
||||
|
|
Loading…
Add table
Reference in a new issue