# Syntax für Data Explorer-Parameter in Automation

**URL:** <https://meta.discourse.org/t/syntax-for-data-explorer-params-in-automation/355916>\
**Category:** Bug\
**Created:** [5. März 2025 um 19:08 UTC](https://meta.discourse.org/t/syntax-for-data-explorer-params-in-automation/355916 "2025-03-05T19:08:21Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)\
**Post date:** [5. März 2025 um 22:46 UTC](https://meta.discourse.org/t/syntax-for-data-explorer-params-in-automation/355916/2 "2025-03-05T22:46:45Z")

</div>

Ich kann das Problem auch reproduzieren.

In Ihrem Beispiel, nehmen wir an, Sie möchten die Gruppen Moderatoren und Administratoren überprüfen, Sie sollten haben:

Schlüssel: `group_name`  
Wert: `moderators,admins`

* * *

Technische Details zur Hilfe, nicht beachten. 😄  
Ich habe versucht, den Code zu verstehen, und ich glaube, hier gibt es ein Problem:

> <https://github.com/discourse/discourse-data-explorer/blob/main/lib/discourse_data_explorer/report_generator.rb#L26>

> <https://github.com/discourse/discourse-data-explorer/blob/main/lib/discourse_data_explorer/report_generator.rb#L40-L58>

Die Parameter werden transformiert, bevor `run_query` aufgerufen wird.  
Nehmen wir an, Sie haben diesen ursprünglichen Wert:  
`[{\"key\":\"group_names\",\"value\":\"admins,moderators\"}]`  
Der transformierte Wert wird sein:  
`{{\"key\"=>\"group_names\", \"value\"=>\"admins,moderators\"}=>nil}`

> <https://github.com/discourse/discourse-data-explorer/blob/main/lib/discourse_data_explorer/data_explorer.rb#L31>

> <https://github.com/discourse/discourse-data-explorer/blob/main/app/models/discourse_data_explorer/query.rb#L37-L43>

Allerdings scheint `cast_params` Folgendes zu erwarten: `{\"group_names\"=>\"admins,moderators\"}`

Ich habe versucht, diese naive Änderung zu testen, und die Parameter funktionierten.

```ruby
def self.params_to_hash(query_params)
  params = JSON.parse(query_params)
  params_hash = {}

  params.each do |param|
    key = param["key"]
    value = param["value"]
    params_hash[key] = value
  end

  params_hash
end

```

---

_[View the full topic](https://meta.discourse.org/t/syntax-for-data-explorer-params-in-automation/355916)._
