Ignore duplicate servers.
This commit is contained in:
parent
860c063f1d
commit
24ace58e88
@ -101,8 +101,16 @@ class Command(BaseCommand):
|
|||||||
servers = parser.run()
|
servers = parser.run()
|
||||||
history = PlayerHistory()
|
history = PlayerHistory()
|
||||||
now = time.time()
|
now = time.time()
|
||||||
|
servers_handled = []
|
||||||
|
|
||||||
for data in servers:
|
for data in servers:
|
||||||
|
# Prevent empty servers with identical names to other, active servers
|
||||||
|
# from fucking with the history
|
||||||
|
if data['title'] in servers_handled:
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
servers_handled.append(data['title'])
|
||||||
|
|
||||||
# TODO: do bulk insert instead!
|
# TODO: do bulk insert instead!
|
||||||
server, created = Server.objects.update_or_create(
|
server, created = Server.objects.update_or_create(
|
||||||
title=data['title'],
|
title=data['title'],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user