feat(inventory-go): min_od/max_od search filters + od sort
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
3c0a8d9de8
commit
fb6b54f9bd
1 changed files with 8 additions and 0 deletions
|
|
@ -23,6 +23,7 @@ import (
|
||||||
const cteSelect = `
|
const cteSelect = `
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
i.id AS db_item_id, i.character_name, i.name, i.icon, i.object_class, i.value, i.burden,
|
i.id AS db_item_id, i.character_name, i.name, i.icon, i.object_class, i.value, i.burden,
|
||||||
|
i.od_rating,
|
||||||
i.current_wielded_location, i.bonded, i.attuned, i."unique", i.stack_size, i.max_stack_size,
|
i.current_wielded_location, i.bonded, i.attuned, i."unique", i.stack_size, i.max_stack_size,
|
||||||
i.structure, i.max_structure, i.rare_id, i.timestamp AS last_updated,
|
i.structure, i.max_structure, i.rare_id, i.timestamp AS last_updated,
|
||||||
COALESCE(cs.max_damage, -1) AS max_damage,
|
COALESCE(cs.max_damage, -1) AS max_damage,
|
||||||
|
|
@ -133,6 +134,7 @@ var sortMapping = map[string]string{
|
||||||
"crit_damage_resist_rating": "crit_damage_resist_rating", "item_set": "item_set",
|
"crit_damage_resist_rating": "crit_damage_resist_rating", "item_set": "item_set",
|
||||||
"coverage": "coverage_mask", "item_type_name": "object_class",
|
"coverage": "coverage_mask", "item_type_name": "object_class",
|
||||||
"last_updated": "last_updated", "spell_names": "computed_spell_names",
|
"last_updated": "last_updated", "spell_names": "computed_spell_names",
|
||||||
|
"od": "od_rating",
|
||||||
}
|
}
|
||||||
|
|
||||||
// argBuilder accumulates positional ($N) query args.
|
// argBuilder accumulates positional ($N) query args.
|
||||||
|
|
@ -219,6 +221,7 @@ func (s *Server) runSearch(ctx context.Context, q url.Values) (map[string]any, e
|
||||||
{"min_pk_damage_resist_rating", "pk_damage_resist_rating"}, {"min_gear_pk_damage_rating", "gear_pk_damage_rating"},
|
{"min_pk_damage_resist_rating", "pk_damage_resist_rating"}, {"min_gear_pk_damage_rating", "gear_pk_damage_rating"},
|
||||||
{"min_gear_pk_damage_resist_rating", "gear_pk_damage_resist_rating"}, {"min_tinks", "tinks"},
|
{"min_gear_pk_damage_resist_rating", "gear_pk_damage_resist_rating"}, {"min_tinks", "tinks"},
|
||||||
{"min_value", "value"}, {"min_workmanship", "workmanship"},
|
{"min_value", "value"}, {"min_workmanship", "workmanship"},
|
||||||
|
{"min_od", "od_rating"},
|
||||||
}
|
}
|
||||||
for _, f := range geFilters {
|
for _, f := range geFilters {
|
||||||
if v := q.Get(f.param); v != "" {
|
if v := q.Get(f.param); v != "" {
|
||||||
|
|
@ -241,6 +244,11 @@ func (s *Server) runSearch(ctx context.Context, q url.Values) (map[string]any, e
|
||||||
conds = append(conds, "attack_bonus >= "+ab.add(n))
|
conds = append(conds, "attack_bonus >= "+ab.add(n))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if v := q.Get("max_od"); v != "" {
|
||||||
|
if n, err := strconv.ParseFloat(v, 64); err == nil {
|
||||||
|
conds = append(conds, "od_rating <= "+ab.add(n))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// --- requirements (wield level) ---
|
// --- requirements (wield level) ---
|
||||||
if v, ok := qInt(q, "max_level"); ok {
|
if v, ok := qInt(q, "max_level"); ok {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue