2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-29 13:21:54 +00:00

merge expeditions and statistics pages

This commit is contained in:
Philip Sargent 2021-03-27 20:05:15 +00:00
parent ffaaea497c
commit c7475cda83
6 changed files with 14 additions and 24 deletions

View File

@ -84,9 +84,10 @@ def expedition(request, expeditionname):
def get_absolute_url(self): def get_absolute_url(self):
return ('expedition', (expedition.year)) return ('expedition', (expedition.year))
class ExpeditionListView(ListView): # django thus expects a template called "expedition_list.html" # replaced by statistics page
# from the name of the object not the name of the class. # class ExpeditionListView(ListView): # django thus expects a template called "expedition_list.html"
model = Expedition # # from the name of the object not the name of the class.
# model = Expedition
class Expeditions_tsvListView(ListView): class Expeditions_tsvListView(ListView):

View File

@ -47,8 +47,7 @@
<a href="{% url "frontpage" %}">tasks to do </a> | <a href="{% url "frontpage" %}">tasks to do </a> |
<a id="cavesLink" href="{% url "caveindex" %}">caves</a> | <a id="cavesLink" href="{% url "caveindex" %}">caves</a> |
<a id="caversLink" href="{% url "personindex" %}">people</a> | <a id="caversLink" href="{% url "personindex" %}">people</a> |
<a id="expeditionsLink" href="{% url "expeditions" %}">all expeditions</a> | <a href="{% url "stats" %}">expo statistics</a> |
<a href="{% url "stats" %}">statistics</a> |
<a href="{% url "controlpanel" %}">import/export data</a> <a href="{% url "controlpanel" %}">import/export data</a>
<a href="/admin/">Django admin</a> <a href="/admin/">Django admin</a>
</div> </div>

View File

@ -1,14 +0,0 @@
{% extends "base.html" %}
{% load wiki_markup %}
{% load link %}
{% block content %}
<h1>Expeditions</h1>
<ul>
{% for expedition in object_list %}
<li>{{ expedition.year }} - <a href="{{ expedition.get_absolute_url }}">{{ expedition.name }}</a></li>
{% empty %}
<li>No articles yet.</li>
{% endfor %}
</ul>
{% endblock %}

View File

@ -1,4 +1,5 @@
{% extends "baseapi.html" %} {% extends "baseapi.html" %}
{% block content %}{ {% block content %}{
{% for expedition in object_list %}{% if not forloop.last %}"{{expedition.year}}": ["{{expedition.name}}","{{expedition.get_absolute_url}}"],{% endif %}{% if forloop.last %}"{{expedition.year}}": ["{{expedition.name}}","{{expedition.get_absolute_url}}"]{% endif %} {% for expedition in object_list %}{% if not forloop.last %}"{{expedition.year}}":
["{{expedition.name}}","{{expedition.get_absolute_url}}"],{% endif %}{% if forloop.last %}"{{expedition.year}}": ["{{expedition.name}}","{{expedition.get_absolute_url}}"]{% endif %}
{% endfor %} }{% endblock %} {% endfor %} }{% endblock %}

View File

@ -5,7 +5,8 @@
{% block title %}Expo statistics{% endblock %} {% block title %}Expo statistics{% endblock %}
{% block content %} {% block content %}
<h1>Expo Statistics</h1>
<h1>Expedition Statistics</h1>
<p>{{ expoCount }} expeditions: {{ personCount }} people, {{ caveCount }} caves and {{ logbookEntryCount }} logbook entries. <p>{{ expoCount }} expeditions: {{ personCount }} people, {{ caveCount }} caves and {{ logbookEntryCount }} logbook entries.
@ -14,13 +15,13 @@ Total length: {{addupsurvexlength|stringformat:".1f"}} km adding up the total fo
<p>These are uncorrected tape lengths which include pitches and duplicates but exclude splays or surface-surveys. <p>These are uncorrected tape lengths which include pitches and duplicates but exclude splays or surface-surveys.
<p> <p>
This is work in progress (July 2020). This is work in progress (March 2021).
<table> <table>
<tr><th>Year</th><th>Survex<br>Survey<br>Blocks</th><th>Survex<br>Survey Legs</th><th>Total length<br>(m)</th></tr> <tr><th>Year</th><th>Survex<br>Survey<br>Blocks</th><th>Survex<br>Survey Legs</th><th>Total length<br>(m)</th></tr>
{% for legs in legsbyexpo %} {% for legs in legsbyexpo %}
<tr> <tr>
<td>{{legs.0.year}}</td> <td style="text-align:center"><a href="{{ legs.0.get_absolute_url }}">{{legs.0}}</a></td>
<td style="text-align:center">{{legs.0.survexblock_set.all|length}}</td> <td style="text-align:center">{{legs.0.survexblock_set.all|length}}</td>
<td style="text-align:center">{{legs.1.nsurvexlegs|rjust:"10"}} </td> <td style="text-align:center">{{legs.1.nsurvexlegs|rjust:"10"}} </td>
<td style="text-align:right">{{legs.1.survexleglength}}</td> <td style="text-align:right">{{legs.1.survexleglength}}</td>
@ -30,4 +31,7 @@ This is work in progress (July 2020).
<p>One Survex Survey Block is one *begin/*end block of data in a survex file. <p>One Survex Survey Block is one *begin/*end block of data in a survex file.
Some files from other caving clubs may have a convention of using many more blocks per file than we do, e.g. if the Some files from other caving clubs may have a convention of using many more blocks per file than we do, e.g. if the
file is exported from other software into survex format. file is exported from other software into survex format.
{% endblock %} {% endblock %}

View File

@ -66,7 +66,6 @@ actualurlpatterns = [
# url(r'^personform/(.*)$', personForm), # url(r'^personform/(.*)$', personForm),
url(r'^expedition/(\d+)$', views_logbooks.expedition, name="expedition"), url(r'^expedition/(\d+)$', views_logbooks.expedition, name="expedition"),
url(r'^expeditions/?$', views_logbooks.ExpeditionListView.as_view(), name="expeditions"),
url(r'^api/expeditions_tsv$', views_logbooks.Expeditions_tsvListView.as_view()), url(r'^api/expeditions_tsv$', views_logbooks.Expeditions_tsvListView.as_view()),
url(r'^api/expeditions_json$', views_logbooks.Expeditions_jsonListView.as_view()), url(r'^api/expeditions_json$', views_logbooks.Expeditions_jsonListView.as_view()),
url(r'^personexpedition/(?P<first_name>[A-Z]*[a-z&;]*)[^a-zA-Z]*(?P<last_name>[A-Z]*[a-zA-Z&;]*)/(?P<year>\d+)/?$', views_logbooks.personexpedition, name="personexpedition"), url(r'^personexpedition/(?P<first_name>[A-Z]*[a-z&;]*)[^a-zA-Z]*(?P<last_name>[A-Z]*[a-zA-Z&;]*)/(?P<year>\d+)/?$', views_logbooks.personexpedition, name="personexpedition"),