Added Conflicting Claims count pill on Claims listing#405
Added Conflicting Claims count pill on Claims listing#405prathambatra wants to merge 1 commit intocoding-blocks:masterfrom
Conversation
Signed-off-by: prathambatra <batrapratham999@gmail.com>
|
Thanks @prathambatra, for opening the pull request! 🙌 One of our mentors will review the pull request soon. ✅ Star ⭐ this project and tweet 🐦 about your contributions. |
|
@hereisnaman |
| issueUrlDetail = getUrlDetails(claim["issueUrl"]) | ||
| conflictKey = issueUrlDetail.project + '/' + pullUrlDetail.type + '/' +issueUrlDetail.id | ||
| if(conflictCounts[conflictKey] === undefined) { | ||
| const c = await du.getConflictsCount(claim,issueUrlDetail,pullUrlDetail.type) |
There was a problem hiding this comment.
How can a query inside a loop be a single query. Try to write a separate raw query for this.
There was a problem hiding this comment.
ok so you mean, there is no need for a loop just a query wich groups all conflicts for all claims. ??
|
@hereisnaman I just realized that there is no need for a DB query because we are querying for all the claims on claims/view page. so we can use our conflict logic to find conflicts count without any query. We can do this in linear time (total number of claims) using a hashmap. should I proceed in this way? |
The claim view page is paginated, why are we querying all the claims? |
Signed-off-by: prathambatra batrapratham999@gmail.com



fixes #399
For optimizing, I have reduced db queries by using the fact if a claim is a conflict to another claim then vice versa is also true. conflictKey is used for the same type of claims and for all these claims only 1 db count query is performed. if there are no conflicts, no badge is shown.