Browse Source

Fix, nicer size.

tags/v0.1^2
Ben Kurtovic 13 years ago
parent
commit
e05e0fcc75
1 changed files with 7 additions and 3 deletions
  1. +7
    -3
      bot/tasks/afc_statistics.py

+ 7
- 3
bot/tasks/afc_statistics.py View File

@@ -311,7 +311,7 @@ class Task(BaseTask):
return return


short = self.get_short_title(title) short = self.get_short_title(title)
size = len(content)
size = self.get_size(content)
c_user, c_time, c_id = self.get_create(pageid) c_user, c_time, c_id = self.get_create(pageid)
m_user, m_time, m_id = self.get_modify(pageid) m_user, m_time, m_id = self.get_modify(pageid)
s_user, s_time, s_id = self.get_special(pageid, chart) s_user, s_time, s_id = self.get_special(pageid, chart)
@@ -349,7 +349,7 @@ class Task(BaseTask):
dict_cursor.execute(query, (pageid,)) dict_cursor.execute(query, (pageid,))
result = dict_cursor.fetchall()[0] result = dict_cursor.fetchall()[0]


size = len(content)
size = self.get_size(content)
m_user, m_time, m_id = self.get_modify(pageid) m_user, m_time, m_id = self.get_modify(pageid)
notes = self.get_notes(chart, content, m_time, result["page_create_user"]) notes = self.get_notes(chart, content, m_time, result["page_create_user"])


@@ -488,7 +488,7 @@ class Task(BaseTask):
else: else:
status, chart = None, CHART_MISPLACE status, chart = None, CHART_MISPLACE


return status
return status, chart


def get_statuses(self, content): def get_statuses(self, content):
"""Return a list of all AFC submission statuses in a page's text.""" """Return a list of all AFC submission statuses in a page's text."""
@@ -554,6 +554,10 @@ class Task(BaseTask):
short = "".join((short[:47], "...")) short = "".join((short[:47], "..."))
return short return short


def get_size(self, content):
"""Return a page's size in a short, pretty format."""
return "{0} kB".format(round(len(content) / 1000.0, 2))

def get_create(self, pageid): def get_create(self, pageid):
"""Return information about a page's first edit ("creation"). """Return information about a page's first edit ("creation").




Loading…
Cancel
Save