Skip to content

Commit ae58fb4

Browse files
fix: adding find_bucket to magic vars example (#117)
* adding find_bucket to magic vars example * Apply suggestions from code review --------- Co-authored-by: Erik Bjäreholt <[email protected]>
1 parent b52a78c commit ae58fb4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/examples/querying-data.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,19 @@ In a query you start by getting events from a bucket and assign that collection
2525
After that you assign what you want to receive from the request to the RETURN variable.
2626

2727
Magic Variables:
28-
2928
There is a magic variable `__CATEGORIES__` you can use in the web UI's Query Explorer to include your configured categories in your query.
3029

31-
Here's an example of using this variable to find all events categorized as "Work"
30+
Here's an example of using this variable to find all events categorized as "Web Browsing"
3231

3332
.. code-block:: python
3433
35-
events = flood(query_bucket("aw-watcher-window_"));
36-
not_afk = flood(query_bucket("aw-watcher-afk_"));
34+
events = flood(query_bucket(find_bucket("aw-watcher-window_")));
35+
not_afk = flood(query_bucket(find_bucket("aw-watcher-afk_")));
3736
not_afk = filter_keyvals(not_afk, "status", ["not-afk"]);
3837
events = filter_period_intersect(events, not_afk);
3938
events = categorize(events, __CATEGORIES__);
4039
events = filter_keyvals(events, "$category", [["Work"]]);
41-
RETURN = events;
40+
RETURN = sort_by_duration(events);
4241
4342
Minimal example:
4443
Minimal query which only gets events from a bucket and returns it:

0 commit comments

Comments
 (0)