Skip to content

Commit

Permalink
Added full support for count and percent.
Browse files Browse the repository at this point in the history
  • Loading branch information
emeryberger committed May 12, 2016
1 parent 747a9c2 commit 67a75d7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
This repo contains the code and data used to build this web page:
http://emeryberger.github.io/CSRank

The code and data for this project were originally written / obtained
by Swarat Chaudhuri (https://www.cs.rice.edu/~sc40/).

To add or modify a faculty member's affiliation, please modify the
file ```faculty-affiliations.csv``` and issue a pull request. Make
sure that the faculty's name corresponds to their <a href="http://dblp.uni-trier.de/search/">DBLP</a> author entry;
Expand Down
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ <h3 class="panel-title">Include publications between
<!-- <input type="button" name="button1" id="button1" value="Recalculate" onclick="rank();"> -->
<input type="button" name="button2" id="button2" value="All On" onclick="activateAll()">
<input type="button" name="button2" id="button2" value="All Off" onclick="activateNone()">
and compute
<select id="displayPercent" name="displayPercent" onchange="rank();" >
<option value="0" selected="selected">sum of all pubs</option>
<option value="1">average percent of all pubs</option>
</select>
</h3>
</div>
</div>
Expand Down
32 changes: 21 additions & 11 deletions js/csrank.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,9 @@ function rank() {
weights["graphics"] = parseFloat($("field_16").value);
weights["hci"] = parseFloat($("field_17").value);
weights["mobile"] = parseFloat($("field_18").value);
startyear = parseInt(jQuery("#startyear").find(":selected").text());
endyear = parseInt(jQuery("#endyear").find(":selected").text());
var startyear = parseInt(jQuery("#startyear").find(":selected").text());
var endyear = parseInt(jQuery("#endyear").find(":selected").text());
var display = parseInt(jQuery("#displayPercent").find(":selected").val());
/* First, count the total number of papers in each area. */
for (var r in authors) {
var area = authors[r].area;
Expand All @@ -447,6 +448,7 @@ function rank() {
areaSum += areacount[a];
}
}
console.log(display);
console.log(areaSum);
/* Build the dictionary of departments (and count) to be ranked. */
for (var r in authors) {
Expand All @@ -460,9 +462,10 @@ function rank() {
univagg[dept] = 0;
}
if (weights[area] > 0) {
univagg[dept] += parseInt(count) * (100.0 / areaSum);
if (dept === "University of Washington") {
console.log(dept,univagg[dept]);
if (display) {
univagg[dept] += parseInt(count) * (100.0 / areaSum);
} else {
univagg[dept] += parseInt(count);
}
if (!(name in visited)) {
visited[name] = true;
Expand All @@ -487,10 +490,13 @@ function rank() {
+ "<div class=\"row\">"
+ "<div class=\"table\">"
+ "<table class=\"table-sm table-striped\""
+ "id=\"ranking\" valign=\"top\">"
/* + "<thead><tr><th align=\"left\">Rank&nbsp;</th><th align=\"right\">Institution&nbsp;</th><th align=\"right\">Count&nbsp;</th><th align=\"right\">Faculty&nbsp;</th><th align=\"right\">Count/Faculty</th></tr></thead>" */
+ "<thead><tr><th align=\"left\">Rank&nbsp;</th><th align=\"right\">Institution&nbsp;</th><th align=\"right\">Percent&nbsp;</th><th align=\"right\">Faculty&nbsp;</th></th></tr></thead>"
+ "<tbody>";
+ "id=\"ranking\" valign=\"top\">";
if (display) {
s = s + "<thead><tr><th align=\"left\">Rank&nbsp;</th><th align=\"right\">Institution&nbsp;</th><th align=\"right\">Percent&nbsp;</th><th align=\"right\">Faculty&nbsp;</th></th></tr></thead>";
} else {
s = s + "<thead><tr><th align=\"left\">Rank&nbsp;</th><th align=\"right\">Institution&nbsp;</th><th align=\"right\">Sum&nbsp;</th><th align=\"right\">Faculty&nbsp;</th></tr></thead>";
}
s = s + "<tbody>";
if (areaSum > 0) {
var i = 0;
var oldv = -100;
Expand All @@ -503,15 +509,19 @@ function rank() {
if ((ind >= minToRank) && (v != oldv)) {
break;
}
if (v < 1) {
if (v === 0.0) {
break;
}
if (oldv != v) {
i = i + 1;
}
s += "\n<tr><td>" + i + "</td>"; /* rank */
s += "<td>" + k + "</td>"; /* institution */
s += "<td align=\"right\">" + Math.floor(10.0 * v) / 10.0 + "%</td>"; /* count */
if (display) {
s += "<td align=\"right\">" + Math.floor(10.0 * v) / 10.0 + "%</td>"; /* count */
} else {
s += "<td align=\"right\">" + v + "</td>"; /* count */
}
s += "<td align=\"right\">" + univcounts[k] + "</td>"; /* faculty */
/* s += "<td align=\"right\">" + Math.floor(10.0 * v / univcounts[k]) / 10.0 + "</td>"; */
s += "</tr>\n";
Expand Down

0 comments on commit 67a75d7

Please sign in to comment.