Verified Commit 9cf33529 authored by Elger Jonker's avatar Elger Jonker

[wip] map doesn't show on main map

parent e11f5a55
Pipeline #39048487 passed with stage
in 20 minutes and 36 seconds
......@@ -157,8 +157,9 @@ class OrganisationSubmissionForm(forms.Form):
name = cleaned_data.get("organization_name")
country = self.contest.target_country
# todo: normalize the name for checking if it exists
exists = Organization.objects.all().filter(
type=organization_type_name, name=name, is_dead=False, country=country).exists()
type=organization_type_name, name__iexact=name, is_dead=False, country=country).exists()
if exists:
raise ValidationError(
......@@ -167,6 +168,18 @@ class OrganisationSubmissionForm(forms.Form):
params={'organization': name},
)
exists = OrganizationSubmission.objects.all().filter(
organization_type_name=organization_type_name,
organization_name__iexact=name,
organization_country=country).exists()
if exists:
raise ValidationError(
_('This organization %(organization)s has been suggested already.'),
code='invalid',
params={'organization': name},
)
# team not participating in contest
if not Team.objects.all().filter(pk=self.team, participating_in_contest=self.contest).exists():
raise ValidationError("This team does not participate in this contest.")
......
......@@ -73,7 +73,7 @@
<nav class="navbar navbar-expand-md navbar-light fixed-top navbar-custom" style="background-color: whitesmoke !important;">
<div class="container">
<a class="navbar-brand" href="#"><i class="fas fa-map-marker-alt"></i> {% trans "Game" %}</a>
<a class="navbar-brand" href="/game/scores/"><i class="fas fa-map-marker-alt"></i> {% trans "Game" %}</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="{% trans "Toggle navigation" %}">
<span class="navbar-toggler-icon"></span>
</button>
......@@ -82,20 +82,20 @@
<ul class="navbar-nav mr-auto">
<li class="nav-item"><a class="nav-link" href="/game/scores/">Scores</a></li>
<li class="nav-item"><a class="nav-link" href="/game/map/">Map</a></li>
<li class="nav-item"><a class="nav-link" href="/game/contests/">Contest</a></li>
<li class="nav-item"><a class="nav-link" href="/game/contests/">Contests</a></li>
<li class="nav-item"><a class="nav-link" href="/game/team/">Teams</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="/game/submit_organization/" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Submit Organization <span class="caret"></span></a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="/game/submit_organization/">Submit Organization</a>
<a class="dropdown-item" href="/game/submitted_organizations/">Submitted Organizations</a>
<a class="dropdown-item" href="/game/submitted_organizations/">Known / Submitted Organizations</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="/game/submit_url/" id="navbarDropdown2" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Submit Url<span class="caret"></span></a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown2">
<a class="dropdown-item" href="/game/submit_url/">Submit Url</a>
<a class="dropdown-item" href="/game/submitted_urls/">Submitted Urls</a>
<a class="dropdown-item" href="/game/submitted_urls/">Known / Submitted Urls</a>
</div>
</li>
</ul>
......
......@@ -517,7 +517,8 @@ def contest_map_data(request):
# todo: make sure that there are no strings in the database, because of this uglyness
updated_features = []
for feature in features:
if isinstance(feature['geometry']['coordinates'], str):
# also check that there is something stored at all...
if isinstance(feature['geometry']['coordinates'], str) and feature['geometry']['coordinates']:
feature['geometry']['coordinates'] = json.loads(feature['geometry']['coordinates'])
else:
updated_features.append(feature)
......@@ -618,11 +619,9 @@ def add_bare_url_features(features, submitted_urls):
if organization_in_features(submitted_url.for_organization, features):
continue
# else create a nice dummy feature
# take into account that some contests / urls could not associated with a region. If there is no region
# attached to it, there is also nothing to plot, thus return the existing features
if not submitted_url.for_organization.coordinate_set:
if not submitted_url.for_organization.coordinate_set.count():
continue
# get the last known coordinate from this set. They are (usually) ordered by date. But it doesn't matter much
......
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