Skip to content

Commit

Permalink
rank assessments: add direct link with API request
Browse files Browse the repository at this point in the history
  • Loading branch information
hobovsky authored Nov 2, 2022
1 parent 5ea0d5f commit b549c13
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions polyglot.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,13 @@ function rankAssessmentsBreakdownDownloaded(resp) {
addRankAssessmentBreakdown(breakdownEntries, elem);
}

function getRankAssesmentsUrl(kataId) {
return `/api/v1/code-challenges/${kataId}/assessed-ranks`;
}

function fetchRankAssessmentBreakdown(kataId, elem) {

let url = `/api/v1/code-challenges/${kataId}/assessed-ranks`;
let url = getRankAssesmentsUrl(kataId);
let opts = {
method: "GET",
url: url,
Expand All @@ -437,15 +441,16 @@ function addRankAssessmentsUi(elem) {

let leftCell = jQuery(allCells[8]);

let kataId = getViewedKataId();
if(!jQuery('#glotToggleBreakdown').length) {
leftCell.append(' <a id="glotToggleBreakdown">(see breakdown)</a>');
leftCell.append(` <a id="glotToggleBreakdown">(see breakdown)</a> <a id="glotBreakdownLink" href="${getRankAssesmentsUrl(kataId)}">(link)</a>`);
jQuery('#glotToggleBreakdown').click(toggleRankAssessmentsBreakdown);
}

let kataId = getViewedKataId();
fetchRankAssessmentBreakdown(kataId, leftCell);
}


/********************************
* order user rank breakdown *
********************************/
Expand Down

0 comments on commit b549c13

Please sign in to comment.