Commit dcebbcd2 authored by Oskar Skog's avatar Oskar Skog

Whoopsie

parent 2d40bc7e
......@@ -190,7 +190,9 @@ class hiscores():
def _load(self):
'''Load `self.hiscores` from `self.hiscorefile`.'''
def line_to_entry(line):
return tuple(line.split(':', 4))
parts = line.split(':', 4)
parts[0] = parts[0].replace('+nocount', '')
return tuple(parts)
try:
f = open(self.hiscorefile, 'rb')
except IOError as err:
......@@ -257,12 +259,15 @@ class hiscores():
Returns the sorted and tail truncated sublist.
self_reference.hiscores does not contain the sublist.
'''
filter_f = (lambda entry:
entry[0].replace('+nocount', '')
== self_reference.paramstring)
self_reference._load()
sublist = list(filter(filter_f, self_reference.hiscores))
self.hiscores = list(filter(filter_f, self_reference.hiscores))
sublist = list(filter(
lambda entry: entry[0] == self_reference.paramstring,
self_reference.hiscores
))
self.hiscores = list(filter(
lambda entry: entry[0] != self_reference.paramstring,
self_reference.hiscores
))
# Add entry.
sublist.append(new_entry)
self._sort(sublist, self.paramstring.startswith('lost/'))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment