جدول نص الأتمتة PM مع نتائج مستكشف البيانات لا يرسل رسائل PM

نحن نستخدم نسخة مستضافة من Discourse ونستفيد من المكون الإضافي للأتمتة المقدم مع مجموعة من البرامج النصية والمشغلات، ومع ذلك نواجه مشكلات في تلقي رسائل خاصة من البرنامج النصي “جدولة رسالة خاصة مع نتائج مستكشف البيانات”.
يبدو أن مشغل الأتمتة يعمل ويتم تشغيل استعلام مستكشف البيانات (يعمل هذا الاستعلام وينتج نتائج عند تشغيله يدويًا)، ومع ذلك لا نتلقى أي رسائل خاصة بعد ذلك. لقد جربت مع نفسي كمستلم وأيضًا مجموعة “المسؤول” ولكن في كلتا الحالتين لم يتم تلقي أي رسائل خاصة.

لست متأكدًا مما إذا كنت أغفل شيئًا واضحًا هنا ولكن أي مساعدة ستكون موضع تقدير.

إعجاب واحد (1)

مرحباً كريستيان :wave:

هل ترى أي شيء ذي صلة في /logs؟

إعجابَين (2)

أعتقد أنني أرى شيئًا مشابهًا:

يبدو أن استعلام مستكشف البيانات قد تم تشغيله:

ولكن لم يتم تسليم أي رسالة خاصة. أرى هذا الخطأ في /logs:

Message (5 copies reported)

Job exception: undefined method `to_sym' for nil:NilClass


Backtrace

/var/www/discourse/plugins/discourse-data-explorer/lib/result_to_markdown.rb:20:in `block (2 levels) in convert'
/var/www/discourse/plugins/discourse-data-explorer/lib/result_to_markdown.rb:18:in `each'
/var/www/discourse/plugins/discourse-data-explorer/lib/result_to_markdown.rb:18:in `each_with_index'
/var/www/discourse/plugins/discourse-data-explorer/lib/result_to_markdown.rb:18:in `block in convert'
/var/www/discourse/plugins/discourse-data-explorer/lib/result_to_markdown.rb:15:in `each'
/var/www/discourse/plugins/discourse-data-explorer/lib/result_to_markdown.rb:15:in `convert'
/var/www/discourse/plugins/discourse-data-explorer/lib/report_generator.rb:20:in `generate'
/var/www/discourse/plugins/discourse-data-explorer/plugin.rb:117:in `block (4 levels) in activate!'
/var/www/discourse/plugins/discourse-automation/app/models/discourse_automation/automation.rb:83:in `trigger!'
/var/www/discourse/plugins/discourse-automation/app/jobs/scheduled/discourse_automation_tracker.rb:36:in `run_pending_automation'

أتلقى أيضًا خطأ “500” إذا حاولت تشغيل الأتمتة يدويًا، وهذا الخطأ (المختلف قليلاً) في السجلات:

Message (4 copies reported)

NoMethodError (undefined method `to_sym' for nil:NilClass)
app/controllers/application_controller.rb:418:in `block in with_resolved_locale'
app/controllers/application_controller.rb:418:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:74:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:369:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
lib/middleware/request_tracker.rb:228:in `call'

Backtrace

plugins/discourse-data-explorer/lib/result_to_markdown.rb:20:in `block (2 levels) in convert'
plugins/discourse-data-explorer/lib/result_to_markdown.rb:18:in `each'
plugins/discourse-data-explorer/lib/result_to_markdown.rb:18:in `each_with_index'
plugins/discourse-data-explorer/lib/result_to_markdown.rb:18:in `block in convert'
plugins/discourse-data-explorer/lib/result_to_markdown.rb:15:in `each'
plugins/discourse-data-explorer/lib/result_to_markdown.rb:15:in `convert'
plugins/discourse-data-explorer/lib/report_generator.rb:20:in `generate'
plugins/discourse-data-explorer/plugin.rb:117:in `block (4 levels) in activate!'
plugins/discourse-automation/app/models/discourse_automation/automation.rb:83:in `trigger!'
plugins/discourse-automation/app/controllers/discourse_automation/automations_controller.rb:10:in `trigger'

لننقلها إلى Bug ونرى ما إذا كان بإمكاننا أن نجعل شخصًا ما يلقي نظرة. :+1:

إعجابَين (2)

بعد مزيد من التحقيق، أعتقد أنه قد يكون مرتبطًا بنوع الاستعلام الذي تحاول تشغيله. لقد حاولت للتو باستخدام استعلام بسيط جدًا وتمكنت من تشغيله وإرسال رسالة خاصة. هل يمكنك مشاركة استعلامك؟

إعجاب واحد (1)

شكراً لك على النظر في هذا الأمر.
الاستعلام ليس بسيطًا تمامًا ويبدو كالتالي:

WITH
ua AS (
  SELECT target_topic_id, COUNT(id) FROM user_actions
  WHERE action_type = 15
  GROUP BY target_topic_id
)
SELECT
  t.id,
  t.title,
  t.created_at,
  t.last_posted_at,
  t.views,
  t.posts_count,
  t.user_id,
  t.last_post_user_id
FROM topics t
INNER JOIN users us ON us.id = t.user_id
LEFT JOIN ua ON ua.target_topic_id = t.id
WHERE t.deleted_at IS NULL
  AND t.closed = false
  AND t.archived = false
  AND t.visible = true
  AND ua.target_topic_id IS NULL
  AND us.username_lower != 'system'
  AND t.created_at > now() - INTERVAL '7' DAY
ORDER BY created_at DESC

كما قلت، فإنه يعمل يدويًا وينتج نتائج.

إعجاب واحد (1)

عندما تقول يدويًا، هل تقصد تشغيل الاستعلام من مستكشف البيانات أو تشغيل البرنامج النصي من المكون الإضافي للأتمتة؟

إعجاب واحد (1)

من مستكشف البيانات.

إعجاب واحد (1)

أعتقد أن الأمر يتعلق بالسحر من نوع user_id الذي يقوم به مستكشف البيانات عند تحويلها من معرفات عادية إلى روابط قابلة للاستخدام. إذا قمت بتشغيل تقريرك كما هو، فسيحدث خطأ تمامًا كما تراه، ولكن إذا قمت بإزالة كل من t.user_id و t.last_post_user_id من SELECT، فسيتم العمل.

إذا قمت بتحويلها إلى أسماء مستخدمين عادية، فستعمل أيضًا بشكل صحيح من خلال الأتمتة:


WITH
ua AS (
  SELECT target_topic_id, COUNT(id) FROM user_actions
  WHERE action_type = 15
  GROUP BY target_topic_id
)
SELECT
  t.id,
  t.title,
  t.created_at,
  t.last_posted_at,
  t.views,
  t.posts_count,
  us.username,
  u2.username
FROM topics t
INNER JOIN users us ON us.id = t.user_id
LEFT JOIN ua ON ua.target_topic_id = t.id
JOIN users u2 ON u2.id = t.last_post_user_id
WHERE t.deleted_at IS NULL
  AND t.closed = false
  AND t.archived = false
  AND t.visible = true
  AND ua.target_topic_id IS NULL
  AND us.username_lower != 'system'
  AND t.created_at > now() - INTERVAL '7' DAY
ORDER BY created_at DESC

على الرغم من أننا قمنا أيضًا بإبلاغ شخص أكثر معرفة لإلقاء نظرة بمزيد من التفصيل. :+1: :slight_smile:


على الرغم من ذلك، بشكل منفصل، لست متأكدًا مما إذا كان استعلامك يفعل ما تريد. هل يتعلق الأمر بالحل بطريقة ما، حيث أرى الكثير من رسائل PM في نتائجي؟

3 إعجابات

شكرًا، سأجرب ذلك مع تغييرات في معرف المستخدم.

لم أكتب هذا الاستعلام في الأصل، لذا لم أحدد بعد ما إذا كان سيعطينا ما نريده على أي حال، لذا ربما سأعيد كتابته.

إعجابَين (2)

إنه هذا السطر: https://github.com/discourse/discourse-data-explorer/blob/705753216cc632b4f6505d2000926ab3b73d8628/lib/result_to_markdown.rb#L20

related = relations.dig(colrender[col_index].to_sym) if col_index < colrender.size

الشرط if في النهاية غير صحيح: من المفترض أن يكون colrender متفرقًا، وليس مكدسًا. سيحتوي على قيم فارغة إذا كانت بعض الأعمدة، وليس كلها، توفر بيانات عرض إضافية.

التحقق الصحيح سيكون على الأرجح unless colrender[col_index].nil?

أيضًا، يبدو أن هذا الرمز يتجاهل أنواع العرض url و reltime و html لأنها ليست فئات ActiveRecord.

6 إعجابات

بالنسبة لي، يبدو أنني لا أستطيع تشغيل هذا البرنامج النصي للأتمتة بنجاح، بغض النظر عن استعلام مستكشف البيانات. على سبيل المثال:

SELECT username from users
LIMIT 10

خطأ 500 عند التشغيل اليدوي من الأتمتة:

رسالة (تم الإبلاغ عن 3 نسخ)

TypeError (Nil is not a valid JSON source.)
app/controllers/application_controller.rb:418:in `block in with_resolved_locale'
app/controllers/application_controller.rb:418:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:74:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:369:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
lib/middleware/request_tracker.rb:228:in `call'

Backtrace

plugins/discourse-data-explorer/lib/report_generator.rb:42:in `parse'
plugins/discourse-data-explorer/lib/report_generator.rb:42:in `params_to_hash'
plugins/discourse-data-explorer/lib/report_generator.rb:15:in `generate'
plugins/discourse-data-explorer/plugin.rb:117:in `block (4 levels) in activate!'
plugins/discourse-automation/app/models/discourse_automation/automation.rb:83:in `trigger!'
plugins/discourse-automation/app/controllers/discourse_automation/automations_controller.rb:10:in `trigger'
actionpack (7.0.4.3) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (7.0.4.3) lib/abstract_controller/base.rb:215:in `process_action'
actionpack (7.0.4.3) lib/action_controller/metal/rendering.rb:53:in `process_action'
actionpack (7.0.4.3) lib/abstract_controller/callbacks.rb:234:in `block in process_action'

Env

HTTP HOSTS: discourse.canapin.dev

يجب إصلاح هذه المشكلات التي تم تجربتها باستخدام طلب السحب هذا:

4 إعجابات

تم إغلاق هذا الموضوع تلقائيًا بعد يومين. لم يعد يُسمح بالردود الجديدة.