Skip to content

Commit

Permalink
api changed
Browse files Browse the repository at this point in the history
  • Loading branch information
hsyndeniz committed Jan 18, 2018
1 parent 4cc7c5c commit 5fe70b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 109 deletions.
7 changes: 4 additions & 3 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ var task_ideas;
var task_count;


var stats_url = "https://utopian-report.herokuapp.com/stats/";
var stats_url = "https://api.utopian.io/api/stats";
var pending = "https://utopian.plus/pendingPosts.json";

request(stats_url, { json: true }, (err, res, body) => {
if (err) { return console.log(err); }
stats = body;
stats = body.stats;
console.log(stats);
vid_tuts = stats.categories["video-tutorials"];
sub_projects = stats.categories["sub-projects"];
bugs = stats.categories["bug-hunting"];
Expand All @@ -36,7 +37,7 @@ request(stats_url, { json: true }, (err, res, body) => {
task_ideas = stats.categories["task-ideas"];

task_count = task_social.total_posts + task_documentation + task_graphics.total_posts + task_translations.total_posts + task_development.total_posts + task_ideas.total_posts;
console.log(task_count);
// console.log(task_count);
});

request(pending, {json:true}, (err, res, body) => {
Expand Down
108 changes: 2 additions & 106 deletions views/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,8 @@
</div>
<br>

<ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="pills-home-tab" data-toggle="pill" href="#pills-home" role="tab" aria-controls="pills-home" aria-selected="true">Approved Contributions</a>
</li>
<li class="nav-item">
<a class="nav-link" id="pills-profile-tab" data-toggle="pill" href="#pills-profile" role="tab" aria-controls="pills-profile" aria-selected="false">Unreviewed Contributions</a>
</li>
</ul>
<div class="tab-content" id="pills-tabContent">
<div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab"> <div id="chartdiv"></div>
</div>
<div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab">
<div id="chartdiv2"></div>
</div>
</div>

<div id="chartdiv"></div>


</div>
Expand Down Expand Up @@ -214,97 +201,6 @@
}
</script>

<script>
var chart2 = AmCharts.makeChart("chartdiv2", {
"type": "pie",
"startDuration": 0,
"theme": "light",
"addClassNames": true,
"legend":{
"position":"right",
"marginRight":100,
"autoMargins":false
},
"innerRadius": "30%",
"defs": {
"filter": [{
"id": "shadow",
"width": "200%",
"height": "200%",
"feOffset": {
"result": "offOut",
"in": "SourceAlpha",
"dx": 0,
"dy": 0
},
"feGaussianBlur": {
"result": "blurOut",
"in": "offOut",
"stdDeviation": 5
},
"feBlend": {
"in": "SourceGraphic",
"in2": "blurOut",
"mode": "normal"
}
}]
},
"dataProvider": [{
"category": "Blog",
"value": <%= unreviewed.categories.blog %>
}, {
"category": "Analysis",
"value": <%= unreviewed.categories.analysis %>
}, {
"category": "Tutorials",
"value": <%= unreviewed.categories.tutorials %>
}, {
"category": "Video Tutorials",
"value": <%= unreviewed.categories.video_tutorials %>
}, {
"category": "CopyWriting",
"value": <%= unreviewed.categories.copywriting %>
}, {
"category": "Documentation",
"value": <%= unreviewed.categories.documentation %>
}, {
"category": "Graphics",
"value": <%= unreviewed.categories.graphics %>
}, {
"category": "Translations",
"value": <%= unreviewed.categories.translations %>
}, {
"category": "Bug Hunting",
"value": <%= unreviewed.categories.bug_hunting %>
}, {
"category": "Development",
"value": <%= unreviewed.categories.development %>
}, {
"category": "Ideas",
"value": <%= unreviewed.categories.ideas %>
}, {
"category": "Tasks",
"value": <%= unreviewed.categories.tasks %>
}],
"valueField": "value",
"titleField": "category",
"export": {
"enabled": true
}
});
chart.addListener("init", handleInit);
chart.addListener("rollOverSlice", function(e) {
handleRollOver(e);
});
function handleInit(){
chart.legend.addListener("rollOverItem", handleRollOver);
}
function handleRollOver(e){
var wedge = e.dataItem.wedge.node;
wedge.parentNode.appendChild(wedge);
}
</script>

</body>
</html>

0 comments on commit 5fe70b7

Please sign in to comment.