Closed SidharthBansal closed 4 years ago
Part of #4131
Hmm, I think we may need to hold on this for the time being, as I can't think of a way to do this efficiently esp if the tags are updated later.
OK, my comment from #3932 could potentially help us prompt subscriptions for tags from another source, adding a new prompt below instead of replacing this section.
The idea is to identify tags people have been active on, but aren't subscribed to -- something like
user.active_topics(limit)
-- which could return a max of limit
tags for:
Then we'd have a list of likely candidates to prompt them to subscribe to. This is an unrelated project but could be swapped in for this one (since I agree with your comment above).
Then we could use user.active_topics
to prompt users in places like the
dashboard or tags page, with something like "You've been posting a lot on
[air-quality]. Click here to follow that topic."
I will be working on this issue commented by Jeff.
On Fri, Jan 18, 2019, 1:23 AM Jeffrey Warren <notifications@github.com wrote:
OK, my comment from #3932 https://github.com/publiclab/plots2/issues/3932 could potentially help us prompt subscriptions for tags from another source, adding a new prompt below instead of replacing this section.
The idea is to identify tags people have been active on, but aren't subscribed to -- something like user.active_topics(limit) -- which could return a max of limit tags for:
- tags user is not subscribed to
- which occur a lot on nodes they've posted
- which occur a lot on nodes on which they've commented
- we could limit this using time if we wanted to optimize! Or cache it.
Then we'd have a list of likely candidates to prompt them to subscribe to. This is an unrelated project but could be swapped in for this one (since I agree with your comment above).
Then we could use user.active_topics to prompt users in places like the dashboard or tags page, with something like "You've been posting a lot on [air-quality]. Click here to follow that topic."
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/4644#issuecomment-455309503, or mute the thread https://github.com/notifications/unsubscribe-auth/AUACQzxYn12BbfEpPAKH0e8Xe_vyhdldks5vENStgaJpZM4aGcyJ .
@jywarren it will be really helpful if you can tell some good resources for cache management and how we do this in plots2 as I have never worked at plots2 with cache. I think it will be just a model function in tags model. It is interesting idea. You suggested me this in August but I was never able to find time on this due to gci. Will do this first.
On Fri, Jan 18, 2019, 2:01 AM Sidharth Bansal <bansal.sidharth2996@gmail.com wrote:
I will be working on this issue commented by Jeff.
On Fri, Jan 18, 2019, 1:23 AM Jeffrey Warren <notifications@github.com wrote:
OK, my comment from #3932 https://github.com/publiclab/plots2/issues/3932 could potentially help us prompt subscriptions for tags from another source, adding a new prompt below instead of replacing this section.
The idea is to identify tags people have been active on, but aren't subscribed to -- something like user.active_topics(limit) -- which could return a max of limit tags for:
- tags user is not subscribed to
- which occur a lot on nodes they've posted
- which occur a lot on nodes on which they've commented
- we could limit this using time if we wanted to optimize! Or cache it.
Then we'd have a list of likely candidates to prompt them to subscribe to. This is an unrelated project but could be swapped in for this one (since I agree with your comment above).
Then we could use user.active_topics to prompt users in places like the dashboard or tags page, with something like "You've been posting a lot on [air-quality]. Click here to follow that topic."
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/4644#issuecomment-455309503, or mute the thread https://github.com/notifications/unsubscribe-auth/AUACQzxYn12BbfEpPAKH0e8Xe_vyhdldks5vENStgaJpZM4aGcyJ .
I think
def self.related(tag_name) Rails.cache.fetch('related-tags/' + tag_name, expires_in: 1.weeks) do nids = NodeTag.joins(:tag) .where(Tag.table_name => { name: tag_name }) .select(:nid) Tag.joins(:node_tag) .where(NodeTag.table_name => { nid: nids }) .where.not(name: tag_name) .group(:tid) .order('COUNT(term_data.tid) DESC') .limit(5) end end
can help me using cache.
This is actually a really great resource! https://guides.rubyonrails.org/caching_with_rails.html
Okay thanks I will try.
I read this two years ago. Will do a revision.
We'll merge this into the new dashboard design which has plentiful subscription prompts! #6072 Thanks!!!
Tthis isn't like a normal view here, the view is being rendered through cache, from an entry in the database, here are the links: https://github.com/publiclab/plots2/blob/9f7cfc47ded41ed3a7370c66a9c4f7af9704af59/app/views/sidebar/_dashboard.html.erb#L38-L41
https://github.com/publiclab/plots2/blob/9f7cfc47ded41ed3a7370c66a9c4f7af9704af59/app/helpers/application_helper.rb#L57-L64
So the view is rendered from the database's entry. Does this make sense?
@jywarren can you help us how we can know the tags passed in this section? We need to pass them in the Subscription button.