Commit Graph

24 Commits

Author SHA1 Message Date
Krzysztof Kotlarek 6ce092d969
FIX: assign queries (#138)
In July, we introduced new Assignment table to discourse-assign plugin (https://github.com/discourse/discourse-assign/pull/169)

Assignment explorer queries had to be updated
2021-09-10 14:17:30 +10:00
Krzysztof Kotlarek b4bdbf7150
FIX: fix ids rake task should be evaluated only once (#76)
Without task('data_explorer:fix_query_ids').clear rake task is evaluated twice
2020-10-14 16:40:40 +11:00
Roman Rizzi 51a047b60c
FIX: Store query groups in a temp table when fixing ids. (#68)
Reintroduces the migration removed in `cdfc5d4`, and fixes it to work with `query_groups`. Since the code is fairly complex, I moved into a rake task so it can be tested and make sure it works.
2020-09-28 12:23:53 -03:00
jjaffeux 4a167a7f5a DEV: attempts to fix indentation 2020-09-25 20:51:53 +02:00
Krzysztof Kotlarek fe0806eb2a
FEATURE: introduce data-explorer tables (#61)
Instead of using `PluginStoreRow` we should use plugin-specific models like `DataExplorer::Query` and `DataExplorer::QueryGroup`
2020-08-27 10:29:57 +10:00
Ricky Chon dcfb92d7f8
FEATURE: Add ability to soft delete (hide) queries and revert deletion with rake tasks (#54)
* FEATURE: Add hide button (toggleable) for all queries (frontend only)

* Switches between hide/unhide on click
* Works almost like the delete button, but toggles between the query's
hidden attribute instead
* So far this is only a frontend feature, the backend implementation
still needs work

* Revert "FEATURE: Add hide button (toggleable) for all queries (frontend only)"

This reverts commit a8771d2ad5.

REVERT: Remove button that hides queries (frontend)

* Prepare for migration of old frontend logic to backend
* We are going to reuse the existing delete button, but change its
backend logic to enable soft deletion. From the user's perspective
nothing will change, but any deletion mistakes can be reverted.

* DEV: Hide user queries upon deletion, but keep them in store

* Creating a new query will set its hidden attribute to false by
default
* Deleting a user-made query will not delete it from the store, but
set its hidden attribute to true
* User queries will not be indexed if they are hidden
* Undeleting a query will unhide it, and will be indexed
* Updating a hidden query will unhide it, and will be indexed

* SPEC: Add spec for hidden/deleted queries

* Hidden queries should not be shown

* FEATURE: Add ability to delete/hide system queries

* System queries are now able to be deleted from view, but will remain
in the backend for retrieval, if necessary

* FEATURE/DEV: Add rake commands for query soft deletion

* query:list_hidden - Shows a list of hidden queries
* query:hide_all[only_default] - Hides all queries, w/ boolean arg to
hide only default ones
* query:unhide[id] - Unhides a query by id
* query:unhide_all[exclude_default] - Unhides all hidden queries,
w/ boolean arg to exclude default ones

* Remove rails loggers

* UX/DEV: Update query rake tasks to be more user friendly

* Split query:hide_all[only_default] into two tasks:
    * query:hide_all - Hides all queries
    * query:hide_all:only_default - Hide only default queries
* Split query:unhide_all[exclude_default] into two tasks:
    * query:unhide_all - Unhides all hidden queries
    * query:unhide_all:exclude_default - Unhides all non-default
    queries
* Rename file to match task name

* UX: query:unhide can accept multiple arguments

* Example: rake query:unhide[-5,-6,-7,3,5,6,-13,-14,-10]

* UX: Update query rake tasks to output cleaner messages

* Remove unneeded comment

* DEV: Keep only necessary rake tasks, use more specific naming

* UX/DEV: Add rake task for hard deletion, better console logs

* User is able to hard delete a query only if it is hidden, otherwise
output a message stating so
* Add commented examples above each task
* Add rainbow support for more readable console logs
* Successful messages will display green, failures display red,
additional info displays yellow
* Separate multiple queries with spaces instead of lines

* DEV: Remove rainbow colorizing in console logs

* Rainbow is a dependency of rubocop and it may go away in the future
* Rainbow is only used for dev and test environments

* DEV: Add Rails engine to enable rake tasks to be loaded at runtime

* DEV: Favor require - load files only if they are not already loaded

* SPEC: Add tests for data_explorer[id] rake command

* Test if a single query is hidden correctly
    * Expect length of query list to not be modified
    * Expect array of hidden queries to have exactly 1 element
    * Expect that one element to have the same ID as the one invoked to
    be hidden
* Test if multiple queries are hidden correctly
    * Expect length of query list to not be modified
    * Expect array of hidden queries to have the number of elements
    equal to the number invoked to be hidden
    * Expect the elements to have the same ID as the ones invoked to be
    hidden
* Test if a query exists in PluginStore
    * Expect query list to be empty

* DEV: Clear pre-existing tasks before redefining

* This prevents double invocation when user invokes the task once

* SPEC: Add tests for unhide_query rake task

* Test if a single query unhides correctly
    * Expect length of query list to not be modified
    * Expect array of hidden queries to have exactly 1 element after
    unhiding 1 of 2 queries
    * Expect remaining element to be hidden
* Test if multiple queries unhide correctly
    * Expect length of query list to not be modified
    * Expect array of hidden queries to have exactly 1 element after
    unhiding 3 of 4 queries
    * Expect remaining element to be hidden
* Test if a query exists in PluginStore
    * Expect query list to not be modified

* SPEC: Add tests for hard_delete rake task

* Test if a single query hard deletes correctly
    * Expect length of query list to be shorter by 1
    * Expect array of hidden queries to have exactly 1 element after
    hard deleting 1 of 2 queries
    * Expect 1 remaining hidden element
* Test if multiple queries hard delete correctly
    * Expect length of query list to be shorter by 3 after hard deleting
    3 of 4 queries
    * Expect array of hidden queries to have exactly 1 element after
    hard deleting 3 of 4 queries
    * Expect 1 remaining hidden element
* Test if a query exists in PluginStore
    * Expect hidden query list to not be modified
* Test if a query is not hidden
    * Expect query list to not be modified

* UX: Favor newline char in place of puts for logs

* Condensed console logs to output newline char instead of another puts
statement (reduces number of lines used significantly)
2020-07-29 16:50:24 +10:00
Michelle Saquetim 5cce9caefd FIX: Add queries description 2020-05-20 16:42:53 +01:00
Michelle Saquetim 2d075fd98c
FIX: Remove a extra blank line 2020-05-20 15:07:14 +01:00
Michelle Saquetim 13094992c9
Add query number of replies by category 2020-05-20 13:13:04 +01:00
Michelle Saquetim c86440a56d
Add query top tags per year 2020-05-20 13:11:36 +01:00
Rafael dos Santos Silva 6f1b246b65 FEATURE: Adds the full HTML of a vote option to poll export 2019-12-05 17:07:09 -03:00
Rafael dos Santos Silva 3ea9a77b27 FEATURE: Add a poll results query 2019-11-22 22:21:22 -03:00
Sam Saffron 29862defaa FEATURE: add support for _url to link to a url
This new feature means that if you name a column `xyz_url` then the return
value will be treated as a URL.

If you would like to name the link use the format `name,https://cnn.com`
2019-05-13 14:44:51 +10:00
Guo Xiang Tan 817a233cef Add frozen string literal comment to files. 2019-05-13 10:42:48 +08:00
Rishabh b83eefd9b8 FEATURE: Re-add the assigned-topics-report query
The assigned-topics-report query was added in 5f3bcab2
but was mistakenly removed by c8ca1e14. I've just re-added it.
2019-05-07 19:21:45 +05:30
Rishabh 3b47c9a597 DEV: make Rubocop happy 2019-05-07 19:16:23 +05:30
Simon Cossar c8ca1e1426 Add a default query for showing the number of replies created by members of a given group (#34) 2019-05-07 18:58:10 +05:30
Sam Saffron 5f3bcab2f8 FEATURE: add query to list all assigned topics
This lists all the topics assigned to all users ordered by user / topic id
2019-04-15 16:11:05 +10:00
Maja Komel 538dc6030f Add a default query for a list of topics user is watching/tracking/muted 2019-03-04 14:43:27 +01:00
Rishabh 7de1e5a68e DEV: Added default queries for finding the most active lurkers and inactive users 2018-12-28 12:15:41 +05:30
Rishabh 931bbb67a0 DEV: Add a default query for Top 50 Largest Uploads 2018-12-24 14:06:06 +05:30
Rishabh 1d97ad6e7e DEV: Add guidelines for adding default queries 2018-11-18 01:49:57 +05:30
bschlagel 7a86163c5f Edit 'quality-users' limit to match description (#27) 2018-10-16 01:51:13 +05:30
Rishabh b352e747c7
FEATURE: Ship default queries with the Data Explorer
Load default queries from queries.rb and save when run.
Each time a query is run, it picks up changes from queries.rb.
2018-10-10 16:59:13 +05:30