-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
group subscription tags with number of subscribers #5224
Changes from 3 commits
aac8f35
fbdb8f6
a595c57
b33bef7
83b647c
e536c80
bf8d12f
8a6eab3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,4 +4,28 @@ | |||||
</div> | ||||||
<div class="col-md-8 col-md-offset-1"> | ||||||
<h2>Subscriptions</h2> | ||||||
</div> | ||||||
<table class="table inline-grid"> | ||||||
<tr> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a huge deal, but would you mind using just 2 spaces for indents? We've tried to standardize a bit on this to help keep our code tidier. Thanks, and sorry for the minute details! 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes of course. sorry I switched to a new editor that I'm still finding my way around. I'll fix that. |
||||||
<thead> | ||||||
<th>Subscriptions</th> | ||||||
<th>Tags</th> | ||||||
</thead> | ||||||
</tr> | ||||||
<% @tags.each do |map| %> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we could rename There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
We could do this because the key will represent the range of numbers, and the value will contain the tags themselves, for example There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh alright. so I'll do away with joining tags to the count with hyphens (-) |
||||||
<% map.each do |subscriptions,tags| %> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we wouldn't have to unpack things, we could skip this line! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay I'll just use the tags map as it is. |
||||||
<tr> | ||||||
<tbody> | ||||||
<td><%=subscriptions%></td> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we could put this, because we'd want to expand back out to the full ranges (since we divided by 10 earlier) -- try this out:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
<td> | ||||||
<select style="width: 50%; height: 50px;"> | ||||||
<%tags.each do |tag| %> | ||||||
<option><%=tag%></option> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then here, I actually think we could just display a list of tags, one per line in plain text, not in a select, so just the tag's name, a colon, and the true count next to it -- remember each of these is in the format <p><%= tag[0] %>: <%= tag[1] %></p> There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Huh, that is so weird. Let me look at the code, but I'm not sure why the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No no. I hadn't used |
||||||
<%end%> | ||||||
</select> | ||||||
</td> | ||||||
</tbody> | ||||||
</tr> | ||||||
<% end %> | ||||||
<% end %> | ||||||
</table> | ||||||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So let's take this for example:
see how if group by v/10 then 34 becomes 3, 66 becomes 6, so ones within 10 of each other get added to the same group?
I think the second
map
is something we can do in the template though, since it relates to how we want to display the data. So i'll suggest:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice that the group is automatically sorted, too!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes actually this works better and is way cleaner. The ruby hash doesn't have the reverse method though I think it's safe to use
sort
?