Find posts "solved" in specific month

I run discourse in a corporate environment as an order and documentation system. I use tags to choose whether an order (topic) is ongoing or completed. But I would need a way to identify orders that are completed in Mars, for example.
Don’t feel like I want to use a tag for every month, eg tag: March19

Have limited visible tags in respective categories to facilitate the creation / maintenance of orders.

image

I had a thought of using hashtags that when something was finished, the person who delivered the order could comment on # march19 at the end of the thread so you could search on that tag. But does it not seem that hashtags work as they should on my discourse, the function may have been removed for the benefit of the tag system?

Are there any other plugins or ways to do this?
Need ideas :slight_smile:

1 Like

If you have admin privileges you could use the data explorer plugin.

2 Likes

Thanks, good suggestion but I am not so familiar with database inquiries so do not know if I even know where to start with it. Can anyone use / view the results of a request through data explorer in any way? Would be good if everyone could sort out examples delivered things in March easily and not just administrators.

Here is a starting point.

-- [params]
-- int :months_ago = 1

WITH query_period AS
(SELECT date_trunc('month', CURRENT_DATE) - INTERVAL ':months_ago months' AS period_start,
                                                    date_trunc('month', CURRENT_DATE) - INTERVAL ':months_ago months' + INTERVAL '1 month' - INTERVAL '1 second' AS period_end)
select posts.*
from posts
inner join ( 
	select topic_id, value::int accepted_answer_post_id 
	from topic_custom_fields 
	where name = 'accepted_answer_post_id'
	order by name 
) solved_by_post
on posts.id = solved_by_post.accepted_answer_post_id
inner join query_period
on posts.created_at >= query_period.period_start
AND posts.created_at <= query_period.period_end
order by posts.created_at desc 

solved-topics-in-month.dcquery (1).json (1.1 KB)

2 Likes

You could run a cron job at the start of each month to get the results and then create a new topic … ‘Orders Completed in March 2019’ with links to each result in the topic.

1 Like