Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ok, so this is an initial implementation of a table view for the /dashboard that will allow us to view more metadata. Currently it is pretty simple as it solely shows the title, votes and tags. That said I have begun refactoring the "querying" to allow us to add more columns. Once I land this PR I'll open individual issues to discuss those a bit further to ensure that they align with the goal/charter of WWW. Here is a quick rundown of the changes and justifications.
addCollection('wantsObject'
: There is currently a collectionwants
but for some reason it returns the following boolitem.inputPath.indexOf("wants/") > -1
. I didn't investigate why this is but I desired to deal directly with the wants themselves. As such I created this query that is similar but returns the want objects themselves in a collection to be worked with later.addCollection('wantsSortedByVotes'
: As noted above, there is a query calledtopWants
but this combined both votes and winning at an event. I desired to have the wants sorted by votes and as such pulled out the sorting and voting from that query into a general collection. Within that query I also add the count of votes to<want>.data.votes
so it can be leveraged later without having to do the lookup in webmentions or creation of ID from url, etc.addCollection('topWantsPerTag'
: This was previously namedtopWants
. As noted above I removed the winners from being included and then leverage the collection fromwantsSortedByVotes
.addCollection('getWinners'
: I pulled out the winning logic from the original query but we do still want to show this. For some reason that I can't explain yet uncommenting that collection throws a template error (it has to do with the.push()
method on the winners array. If you place this same code within thetopWantsPerTag
it works fine, so I'm completely confused as to what's happening but I'm tired and hoping a second pair of eyes can help.Open Questions
Like normal, any feedback is welcome, sorry for the long write up but I wanted to let you all understand that there was thought behind the query refactoring. I considered going further and just building a wants object that had all of the metadata of each want whether it was a winner and its votes but didn't want to do that without discussing it first.