Changeset 313


Ignore:
Timestamp:
May 17, 2007, 1:40:44 PM (16 years ago)
Author:
Peter Johansson
Message:

precentage in tables, fixes #194

Location:
trunk/lib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Directory.cc

    r303 r313  
    206206    }
    207207    else {
    208       os << "<td>" << stats_.lines(user) << "</td>\n";
    209       os << "<td>" << stats_.code(user) << "</td>\n";
    210       os << "<td>" << stats_.comments(user) << "</td>\n";
    211       os << "<td>" << stats_.empty(user) << "</td>\n";
     208      os << "<td>" << stats_.lines(user);
     209      if (stats_.lines(user))
     210        os << " (" << percent(stats_.lines(user),stats_.lines()) << "%)";
     211      os << "</td>\n";
     212      os << "<td>" << stats_.code(user);
     213      if (stats_.code(user))
     214        os << " (" << percent(stats_.code(user),stats_.code()) << "%)";
     215      os << "</td>\n";
     216      os << "<td>" << stats_.comments(user);
     217      if (stats_.comments(user))
     218        os << " (" << percent(stats_.comments(user),stats_.comments()) << "%)";
     219      os << "</td>\n";
     220      os << "<td>" << stats_.empty(user);
     221      if (stats_.empty(user))
     222        os << " (" << percent(stats_.empty(user),stats_.empty()) << "%)";
     223      os << "</td>\n";
    212224    }
    213225    os << "<td>" << trac_revision(stats_.last_changed_rev()) << "</td>\n";
  • trunk/lib/Node.cc

    r306 r313  
    8686    }
    8787    else {
    88       os << "<td>" << stats_.lines(user) << "</td>\n"
    89          << "<td>" << stats_.code(user) << "</td>\n"
    90          << "<td>" << stats_.comments(user) << "</td>\n"
    91          << "<td>" << stats_.empty(user) << "</td>\n";
     88      os << "<td>" << stats_.lines(user);
     89      if (stats_.lines(user))
     90        os << " (" << percent(stats_.lines(user),stats_.lines()) << "%)";
     91      os << "</td>\n";
     92      os << "<td>" << stats_.code(user);
     93      if (stats_.code(user))
     94        os << " (" << percent(stats_.code(user),stats_.code()) << "%)";
     95      os << "</td>\n";
     96      os << "<td>" << stats_.comments(user);
     97      if (stats_.comments(user))
     98        os << " (" << percent(stats_.comments(user),stats_.comments()) << "%)";
     99      os << "</td>\n";
     100      os << "<td>" << stats_.empty(user);
     101      if (stats_.empty(user))
     102        os << " (" << percent(stats_.empty(user),stats_.empty()) << "%)";
     103      os << "</td>\n";
     104
    92105    }
    93106    os << "<td>" << trac_revision(stats_.last_changed_rev()) << "</td>\n"
  • trunk/lib/utility.cc

    r309 r313  
    111111
    112112
     113  int percent(int a, int b)
     114  {
     115    if (b)
     116      return (100*a)/b;
     117    return 0;
     118  }
     119
     120
    113121  bool node_exist(const std::string& path)
    114122  {
  • trunk/lib/utility.h

    r309 r313  
    105105  ///
    106106  bool node_exist(const std::string& path);
     107
     108  /**
     109     @return 0 if \a b = 0 otherwise \f$ \frac{100*a}{b} \f$
     110  */
     111  int percent(int a, int b);
    107112
    108113  ///
Note: See TracChangeset for help on using the changeset viewer.