Skip to content

Commit

Permalink
Merge pull request #107 from VibhorCodecianGupta/master
Browse files Browse the repository at this point in the history
Improved response to multiple claims
  • Loading branch information
championswimmer committed May 29, 2018
2 parents fbdc32f + fcc3a37 commit e370302
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
5 changes: 2 additions & 3 deletions routes/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ route.get('/stats', (req, res) => {
});

route.get('/claims/view', (req, res) => {

const options = {
username: req.query.username,
projectname: req.query.projectname,
Expand Down Expand Up @@ -192,8 +192,7 @@ route.post('/claims/add', auth.ensureLoggedInGithub, (req, res) => {
).then(claim => {
res.redirect('/claims/view')
}).catch((error) => {
console.error(error);
res.send("Error adding claim")
res.render('pages/claims/unique')
});

});
Expand Down
6 changes: 3 additions & 3 deletions utils/datautils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function getClaims(options) {
}else if(options.projectname){
whereClause = { status: options.status, repo : options.projectname };
}

const distinctUsers = db.Claim.aggregate('user', 'DISTINCT', { plain: false, where : { status: options.status} })
const distinctProjects = db.Claim.aggregate('repo', 'DISTINCT', { plain: false, where : { status: options.status} })
const allClaims = db.Claim.findAndCountAll({
Expand Down Expand Up @@ -65,7 +65,7 @@ function updateClaim(claimId, {status, reason, bounty}) {
}

function createClaim(user, issueUrl, pullUrl, bounty, status) {

const claim = {
action: 'create',
user, issueUrl, pullUrl, bounty, status
Expand Down Expand Up @@ -118,7 +118,7 @@ function getCounts() {
const totalclaimed = db.Claim.aggregate(
'bounty',
'sum'
);
);
return Promise.all([participants, claims, accepted, totalclaimed]);
}

Expand Down
9 changes: 9 additions & 0 deletions views/pages/claims/unique.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="ui vertical masthead center aligned segment">
<div class="ui text container">
<h1>
Oops!
</h1>
<h2>Looks like you've already claimed the bounty for this Pull Request.</h2>
<h4>You can claim the bounty for some other issue you resolved or make contributions to the issues with the 'BOSS' label first.</h4>
</div>
</div>

0 comments on commit e370302

Please sign in to comment.