feat: discussions
This commit is contained in:
17
community/www/discussions/index.py
Normal file
17
community/www/discussions/index.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import frappe
|
||||
|
||||
def get_context(context):
|
||||
context.threads = get_threads()
|
||||
|
||||
def get_threads():
|
||||
threads = frappe.get_all("Discussion Thread", fields=["name", "title"])
|
||||
for thread in threads:
|
||||
messages = frappe.get_all("Discussion Message",
|
||||
{
|
||||
"thread": thread.name
|
||||
},
|
||||
["owner"],
|
||||
as_list=True)
|
||||
thread.message_count = len(messages)
|
||||
thread.member_count = len(set(messages))
|
||||
return threads
|
||||
Reference in New Issue
Block a user