Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trending tags showing duplicates #3188

Closed
jywarren opened this issue Aug 2, 2018 · 13 comments
Closed

Trending tags showing duplicates #3188

jywarren opened this issue Aug 2, 2018 · 13 comments
Assignees
Labels
help wanted requires help by anyone willing to contribute Ruby

Comments

@jywarren
Copy link
Member

jywarren commented Aug 2, 2018

We are preparing to participate in Google Code-in, and have reserved this issue for participants in GCI - but we'd love to have your help with another one! Please check out https://code.publiclab.org to see more.

I think we're missing a group() or something on the https://publiclab.org/dashboard's trending tags area - i'm seeing 5 of the same:

screen shot 2018-08-02 at 12 29 19 pm

Here's the code -

plots2/app/models/tag.rb

Lines 268 to 277 in 0663ac5

def self.trending(limit = 5, start_date = DateTime.now - 1.month, end_date = DateTime.now)
Tag.joins(:node_tag, :node)
.select('node.nid, node.created, node.status, term_data.*, community_tags.*')
.where('node.status = ?', 1)
.where('node.created > ?', start_date.to_i)
.where('node.created <= ?', end_date.to_i)
.group([:name, 'node.nid', 'term_data.tid', 'community_tags.nid', 'community_tags.uid', 'community_tags.date']) # ONLY_FULL_GROUP_BY, issue #3120
.order('count DESC')
.limit(limit)
end

And here's the test, where i'm not sure but maybe we should test to be sure they're unique?

test 'Tag.trending(limit, start, end) returns most-used tags for a time period' do
trending_tags = Tag.trending
assert_not_nil trending_tags
assert_not_equal [], trending_tags
assert !trending_tags.empty?
assert_not_nil Tag.trending(2, Time.now - 1.year, Time.now - 1.month)
end

Any help appreciated!

@SidharthBansal
Copy link
Member

This task is published on GCI dashboard. Thanks all.

@vatbq
Copy link
Contributor

vatbq commented Nov 2, 2018

I just have one question, How I send you the task ready? Do I have to do a pull request in repository or what? thanks!

@grvsachdeva
Copy link
Member

grvsachdeva commented Nov 2, 2018

Hi @ValentinaTironi , this task is reserved for Google Code-In students, have you claimed this task from GCI website?

@vatbq
Copy link
Contributor

vatbq commented Nov 2, 2018

@gauravano Hi, thanks for answer. Yes, I did. I arrived here for the task

@grvsachdeva
Copy link
Member

Awesome! You have to open the Pull request with your changes. Thanks!

@vatbq
Copy link
Contributor

vatbq commented Nov 10, 2018

Hi! I'm trying to do a git push to do a pull request here but it says that I don't have permission. What I have to do?

@Rishabh-Kumar-Bothra
Copy link
Contributor

@ValentinaTironi You need to do git push to your forked repository and then create a pull request.
Good luck!

@jywarren
Copy link
Member Author

jywarren commented Nov 13, 2018 via email

@Rishabh-Kumar-Bothra
Copy link
Contributor

@ValentinaTironi It seems like you have not forked the repository. So to get started follow these installation process https://github.com/publiclab/plots2#installation

@jywarren
Copy link
Member Author

jywarren commented Dec 7, 2018

This didn't end up solving the issue, unfortunately! Reopening to see if we can develop another solution.

@vatbq
Copy link
Contributor

vatbq commented Dec 7, 2018

Oh, sorry. Tell me if I can help in something :/

@milaaraujo milaaraujo self-assigned this Dec 8, 2018
@milaaraujo
Copy link
Collaborator

I'll work on this one.

@jywarren
Copy link
Member Author

jywarren commented Dec 10, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted requires help by anyone willing to contribute Ruby
Projects
None yet
Development

No branches or pull requests

6 participants