Sort item names in `info` alphabetically

+ Fixed primary location
doc_update
Joey Hines 2020-10-09 08:30:29 -05:00
parent 8b473d4024
commit 52c8b2757d
2 changed files with 3 additions and 4 deletions

View File

@ -517,11 +517,11 @@ def info(location_name):
if type(loc) == Shop: if type(loc) == Shop:
loc_json["items"] = [] loc_json["items"] = []
for item in loc.shop_selling.all(): for item in loc.shop_selling.order_by("item_name").all():
loc_json["items"].append(item.json) loc_json["items"].append(item.json)
elif type(loc) == PublicFarm: elif type(loc) == PublicFarm:
loc_json["resources"] = [] loc_json["resources"] = []
for resource in loc.resource.all(): for resource in loc.resource.order_by("resource_name").all():
loc_json["resources"].append(resource.json) loc_json["resources"].append(resource.json)
return loc_json return loc_json

View File

@ -113,7 +113,7 @@ class Player(models.Model):
return {"name": self.name, return {"name": self.name,
"mc_uuid": self.mc_uuid, "mc_uuid": self.mc_uuid,
"discord_uuid": self.discord_uuid, "discord_uuid": self.discord_uuid,
"primary_location": self.primary_location.json "primary_location": self.primary_location.id
} }
@property @property
@ -226,7 +226,6 @@ class Location(models.Model):
"location": self.position, "location": self.position,
"tunnel": None if self.tunnel is None else self.tunnel.tunnel_str, "tunnel": None if self.tunnel is None else self.tunnel.tunnel_str,
"link": self.link, "link": self.link,
"primary_location": self.player.primary_location
} }
@property @property