Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions macros/filter-available-and-solved/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Filter the current view for available, unfound, non-owned caches, excluding unsolved Mystery/Unknown caches.

This is a port of the gsak FilterAvailableAndSolved macro, originally written by
This is a port of the GSAK FilterAvailableAndSolved macro, originally written by
Kai Team. Porting was done via Google Gemini AI.

## What it needs
Expand All @@ -16,8 +16,10 @@ Kai Team. Porting was done via Google Gemini AI.

## Example

No example needed.
This macro will narrow your current filter (i.e. it adds additional criteria to your current filter). If you want it to operate across the entire database, clear any active filter first.

## Changes

- 1.0 — first version
- 1.1 — remove unnecessary reference to "Mystery Cache" when evaluating a cache.
provide popup feedback of # of caches matched.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- OpenSAK Macro --
-- Name: Filter Available and Solved
-- Author: OokOok
-- Version: 1.0
-- Version: 1.1
-- Requires-API: 4
-- Description: Filter the current view for available, unfound, non-owned caches, excluding unsolved Mystery/Unknown caches.
-- Permissions: none
Expand All @@ -10,7 +10,7 @@ local matching_codes = {}

-- Loop over caches in the active filter (equivalent to GSAK's $_WHERE)
for c in opensak.caches{ fields = { "found", "available", "archived", "owned", "type", "corrected" } } do
local is_mystery = (c.type == "Mystery Cache" or c.type == "Unknown Cache")
local is_mystery = (c.type == "Unknown Cache")
local is_unsolved_mystery = is_mystery and (c.corrected == nil)

if (not c.found) and c.available and (not c.archived) and (not c.owned) and (not is_unsolved_mystery) then
Expand All @@ -21,8 +21,9 @@ end
if #matching_codes == 0 then
opensak.message("No caches in the current view matched the criteria.", "FilterAvailableAndSolved")
else
opensak.filter{
opensak.message(opensak.filter{
codes = matching_codes,
label = "Available & Solved",
}
.. " caches matched.", "FilterAvailableAndSolved")
end
Loading