[github] download count for latest pre-release#1140
Merged
paulmelnikow merged 8 commits intobadges:masterfrom Oct 9, 2017
platan:issue-1113
Merged
[github] download count for latest pre-release#1140paulmelnikow merged 8 commits intobadges:masterfrom platan:issue-1113
paulmelnikow merged 8 commits intobadges:masterfrom
platan:issue-1113
Conversation
Member
Author
|
#1118 really helped me with developing this change. |
paulmelnikow
reviewed
Oct 9, 2017
Member
paulmelnikow
left a comment
There was a problem hiding this comment.
Thanks a bunch! I left a couple minor comments.
| badgeData.text[1] = metric(downloads); | ||
| if (label) { | ||
| badgeData.text[1] += ' ' + label; | ||
| } |
Member
There was a problem hiding this comment.
This code could be made clearer using Array.prototype.join:
const labelWords = [metric(downloads)];
if (tag !== latest) {
labelWords.push(tag);
}
if (asset_name !== 'total') {
labelWords.push(`[${asset_name}]`);
}
badgeData.text[1] = labelWords.join(' ');This might avoid future bugs too!
| .get('/downloads-pre/photonstorm/phaser/latest/total.json') | ||
| .expectJSONTypes(Joi.object().keys({ | ||
| name: Joi.equal('downloads'), | ||
| value: Joi.string().regex(/^[0-9]+[kMGTPEZY]?$/) |
Member
There was a problem hiding this comment.
Hopefully I will merge #1127 in a moment. Could you DRY this up by using isMetric?
paulmelnikow
approved these changes
Oct 9, 2017
This was referenced Oct 22, 2017
paulmelnikow
added a commit
that referenced
this pull request
Oct 22, 2017
- `isMetric` tests must be > 0 to pass. - Fix downloads badge bug introduced in #1140. (So much for [being clever](#1140 (comment))!) - Fix 1 week activity badge by returning the previous week instead of the current week.
|
PRs like this are the reason I'd argue that it's generally advisable to use GitHub's "squash and merge" option rather than the standard merge. |
Member
|
I think I agree, though this was merged using "squash and merge." |
|
My bad, you're right, sorry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Implements #1113.
Additionally I've removed extra space in 2 cases (failing tests without this change):