Skip to content

Commit

Permalink
some competition ;-).
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1728 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
allo committed Feb 21, 2006
1 parent ff476c1 commit a054051
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions htroot/Network.html
Expand Up @@ -105,6 +105,8 @@ <h2>Manually contacting Peer</h2>
<tr><td colspan="16" align="left"><p><font size="-3"><i>runtime: #[rt]# ms</i></font></p></td></tr>
</table>
</p>
Progress to your next Opponent: #[percent]#%<br />
#{percent}#<img src="/env/grafics/green-bar.png">#{/percent}##{percent2}#<img src="/env/grafics/red-bar.png">#{/percent2}#
::
<p><font size="1">All Peers:<br>
<table border="0" cellpadding="2" cellspacing="1">
Expand Down
13 changes: 13 additions & 0 deletions htroot/Network.java
Expand Up @@ -275,6 +275,7 @@ record = yacyCore.newsPool.get(yacyNewsPool.INCOMING_DB, c);
String wikiPage;
String userAgent, location;
int PPM;
long myValue=0, nextValue=0, prevValue=0;
while (e.hasMoreElements() && conCount < maxCount) {
seed = (yacySeed) e.nextElement();
if (seed != null) {
Expand All @@ -284,8 +285,16 @@ record = yacyCore.newsPool.get(yacyNewsPool.INCOMING_DB, c);
if (conCount >= maxCount) { break; }
if (seed.hash.equals(yacyCore.seedDB.mySeed.hash)) {
prop.put(STR_TABLE_LIST + conCount + "_dark", 2);
myValue=Long.parseLong(seed.get(yacySeed.LCOUNT, "0"));
} else {
prop.put(STR_TABLE_LIST + conCount + "_dark", ((dark) ? 1 : 0) ); dark=!dark;
if(myValue==0)
//before myself: better
nextValue=Long.parseLong(seed.get(yacySeed.LCOUNT, "0"));
else if(nextValue==0)
//after myself: worse
prevValue=Long.parseLong(seed.get(yacySeed.LCOUNT, "0"));

}
if (updatedProfile.contains(seed.hash)) {
prop.put(STR_TABLE_LIST + conCount + "_updatedProfile", 1);
Expand Down Expand Up @@ -398,6 +407,10 @@ record = yacyCore.newsPool.get(yacyNewsPool.INCOMING_DB, c);
prop.put("table_num", conCount);
prop.put("table_total", (maxCount > conCount) ? conCount : maxCount);
prop.put("table_complete", ((complete)? 1 : 0) );

int percent=(int)((float)(myValue-prevValue)/(float)(nextValue-prevValue)*100);
prop.put("table_percent", percent);
prop.put("table_percent2", 100-percent);
}
}
prop.put("page", page);
Expand Down

0 comments on commit a054051

Please sign in to comment.