}\r
fprintf(f,"<td style=\"text-align: right\">%Lu</td>\n", ip->credit);\r
fprintf(f,"<td style=\"text-align: right\"><span style=\"color:#%s\">%Lu</span></td>",\r
- ip->keyword->html_color,\r
- ip->credit+(ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20)));\r
+ ip->keyword->html_color, ip->realquota);\r
fprintf(f,"<td style=\"text-align: right\">%s%Lu%s", f1, ip->traffic, f2);\r
\r
/* download --------------------------------------- */\r
unsigned long long upload;\r
unsigned long long traffic;\r
unsigned long long credit;\r
+ unsigned long long realquota;\r
unsigned long pktsup;\r
unsigned long pktsdown;\r
struct Keyword *keyword;\r
{\r
fprintf(f, ",\n");\r
}\r
- fprintf(f, " \"%s\":{ \"lms\": %d, \"ip\":\"%s\", \"total\":%Lu, \"down\":%Lu, \"proxy\":%Lu, \"up\":%Lu, \"min\":%d, \"max\":%d, \"limit\":%d }",\r
- ip->name, ip->lmsid, ip->addr, ip->traffic, ip->direct, ip->proxy, ip->upload, ip->min, ip->desired, ip->max);\r
+ fprintf(f, " \"%s\":{ \"lms\": %d, \"ip\":\"%s\", \"total\":%Lu, \"down\":%Lu, \"proxy\":%Lu, \"up\":%Lu,\\r
+ \"min\":%d, \"max\":%d, \"limit\":%d, \"realquota\":%Lu, \"credit\":%Lu, \"dailyquota\":%ld }",\r
+ ip->name, ip->lmsid, ip->addr, ip->traffic, ip->direct, ip->proxy, ip->upload, \r
+ ip->min, ip->desired, ip->max, ip->realquota, ip->credit, \r
+ (ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20)));\r
jsoncount++;\r
}\r
}\r
\r
for_each(ip, ips) if(ip->min == group->min && ip->max > ip->min)\r
{\r
- if( ip->keyword->data_limit && !ip->fixedprio \r
- && ( ip->traffic>ip->credit\r
- + (ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20))) )\r
+ ip->realquota=ip->credit+(ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20));\r
+ if( ip->keyword->data_limit \r
+ and not ip->fixedprio \r
+ and ip->traffic > ip->realquota )\r
{\r
- if(group_rate<ip->max)\r
+ if(group_rate < ip->max)\r
{\r
- ip->max=group_rate;\r
+ ip->max = group_rate;\r
}\r
group_rate+=magic_treshold;\r
ip->prio=lowest_priority;\r