Skip to content

Commit 1e83569

Browse files
committed
Refactor Report model
1 parent b88bdb0 commit 1e83569

File tree

8 files changed

+1211
-1102
lines changed

8 files changed

+1211
-1102
lines changed

stats/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ def get_hashtag_map_data(request):
10901090
if report.latest_version:
10911091
n = n + 1
10921092
dates.append(report.server_upload_time)
1093-
data.append({ 'note': report.note, 'picture': report.get_photo_html(), 'lat': report.get_lat(), 'lon': report.get_lon(), 'date_uploaded': report.server_upload_time.strftime('%d-%m-%Y / %H:%M:%S') })
1093+
data.append({ 'note': report.note, 'picture': report.photo_html, 'lat': report.lat, 'lon': report.lon, 'date_uploaded': report.server_upload_time.strftime('%d-%m-%Y / %H:%M:%S') })
10941094
min_date_str = ''
10951095
max_date_str = ''
10961096
if len(dates) == 0:

tigacrafting/templates/tigacrafting/expert_report_annotation.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,10 +1723,8 @@ <h4 class="modal-title" id="searchModalLabel">Search</h4>
17231723

17241724
final_status = {
17251725
score: {{form.instance.report.get_final_combined_expert_score}},
1726-
//category: '{{form.instance.report.get_final_combined_expert_category}}',
17271726
category: '{{form.instance.report.get_final_combined_expert_category_euro}}',
17281727
category_struct: {{form.instance.report.get_final_combined_expert_category_euro_struct_json | safe}},
1729-
//selector_data : {{ form.instance.report.get_selector_data | safe }},
17301728
status: {{form.instance.report.get_final_expert_status }},
17311729
photo: '{{form.instance.report.get_final_photo_html.id}}',
17321730
public_note: '{{form.instance.report.get_final_public_note | linebreaksbr }}',

tigacrafting/templates/tigacrafting/expert_report_status.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,6 @@ <h5>
254254
aria-expanded="false" aria-controls="current_status_collapse{{ forloop.counter }}"><i
255255
class="fa fa-plus-square-o"></i></a>
256256
{{ report.get_final_expert_status_bootstrap | safe }}
257-
<!--<strong>Current Status <i>Albopictus</i>:</strong> {% include "tigacrafting/score_label.html" with score=report.get_final_expert_score text=report.get_final_expert_category %}-->
258-
<!--<strong>Current Status <i>Aegypti</i>:</strong> {% include "tigacrafting/score_label.html" with score=report.get_final_expert_score_aegypti text=report.get_final_expert_category_aegypti %}-->
259-
<!--<strong>Current Status:</strong> {% include "tigacrafting/score_label.html" with score=report.get_final_combined_expert_score text=report.get_final_combined_expert_category %}-->
260257
<strong>Current Status:</strong> {% include "tigacrafting/score_label_euro.html" with text=report.get_final_combined_expert_category_euro color=report.get_html_color_for_label %}
261258
{% else %}
262259
<strong>Status:</strong> Not yet validated by three experts.

tigacrafting/templates/tigacrafting/superexpert_report_annotation.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,8 @@ <h2>{% if edit_mode == 'edit' %}<span style="color:red;">Edit Mode</span>{% elif
134134
<a role="button" data-toggle="collapse" href="#current_status_collapse{{ form.instance.id }}"
135135
aria-expanded="false" aria-controls="current_status_collapse{{ form.instance.id }}"><i class="fa fa-plus-square-o"></i></a>
136136
{{ form.instance.report.get_final_expert_status_bootstrap | safe }}
137-
<!--<strong>Current Status <i>Albopictus</i>:</strong> {% include "tigacrafting/score_label.html" with score=form.instance.report.get_final_expert_score text=form.instance.report.get_final_expert_category %}
138-
<strong>Current Status <i>Aegypti</i>:</strong> {% include "tigacrafting/score_label.html" with score=form.instance.report.get_final_expert_score_aegypti text=form.instance.report.get_final_expert_category_aegypti %}-->
139137
<!-- %EURO_SWITCH% -->
140138
<strong>Current Status:</strong> {% include "tigacrafting/score_label_euro.html" with text=form.instance.report.get_final_combined_expert_category_euro color=form.instance.report.get_html_color_for_label %}
141-
<!-- <strong>Current Status:</strong> {% include "tigacrafting/score_label.html" with score=form.instance.report.get_final_combined_expert_score text=form.instance.report.get_final_combined_expert_category %} -->
142-
<!--<strong>Current Status:</strong> {% include "tigacrafting/score_label.html" with score=form.instance.report.get_final_expert_score text=form.instance.report.get_final_expert_category %}-->
143139

144140
<div class="collapse" id="current_status_collapse{{ form.instance.id }}">
145141
<div class="well">

tigacrafting/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,17 +348,17 @@ def filter_reports(reports, sort=True):
348348

349349
def filter_spain_reports(reports, sort=True):
350350
if sort:
351-
reports_filtered = sorted( filter(lambda x: x.is_spain_p, reports), key=attrgetter('n_annotations'), reverse=True)
351+
reports_filtered = sorted( filter(lambda x: x.is_spain, reports), key=attrgetter('n_annotations'), reverse=True)
352352
else:
353-
reports_filtered = filter(lambda x: x.is_spain_p, reports)
353+
reports_filtered = filter(lambda x: x.is_spain, reports)
354354
return reports_filtered
355355

356356

357357
def filter_eu_reports(reports, sort=True):
358358
if sort:
359-
reports_filtered = sorted(filter(lambda x: not x.is_spain_p, reports), key=attrgetter('n_annotations'), reverse=True)
359+
reports_filtered = sorted(filter(lambda x: not x.is_spain, reports), key=attrgetter('n_annotations'), reverse=True)
360360
else:
361-
reports_filtered = filter(lambda x: not x.is_spain_p, reports)
361+
reports_filtered = filter(lambda x: not x.is_spain, reports)
362362
return reports_filtered
363363

364364

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Generated by Django 2.2.7 on 2024-01-24 12:54
2+
3+
from django.db import migrations, models
4+
import django.db.models.deletion
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('tigaserver_app', '0042_auto_20240124_0739'),
11+
]
12+
13+
operations = [
14+
migrations.AlterField(
15+
model_name='report',
16+
name='app_language',
17+
field=models.CharField(blank=True, help_text='Language setting, within tigatrapp, of device from which this report was submitted. 2-digit ISO-639-1 language code.', max_length=10, null=True),
18+
),
19+
migrations.AlterField(
20+
model_name='report',
21+
name='creation_time',
22+
field=models.DateTimeField(help_text="Date and time on phone when first version of report was created. Format as ECMA 262 date time string (e.g. '2014-05-17T12:34:56.123+01:00'."),
23+
),
24+
migrations.AlterField(
25+
model_name='report',
26+
name='device_manufacturer',
27+
field=models.CharField(blank=True, help_text='Manufacturer of device from which this report was submitted.', max_length=200, null=True),
28+
),
29+
migrations.AlterField(
30+
model_name='report',
31+
name='device_model',
32+
field=models.CharField(blank=True, help_text='Model of device from which this report was submitted.', max_length=200, null=True),
33+
),
34+
migrations.AlterField(
35+
model_name='report',
36+
name='ia_filter_1',
37+
field=models.FloatField(blank=True, help_text='Value ranging from -1.0 to 1.0 positive values indicate possible insect, negative values indicate spam(non-insect)', null=True),
38+
),
39+
migrations.AlterField(
40+
model_name='report',
41+
name='ia_filter_2',
42+
field=models.FloatField(blank=True, help_text='Score for best classified image. 0 indicates not classified, 1.xx indicates classified with score xx, 2.xx classified with alert with score xx.', null=True),
43+
),
44+
migrations.AlterField(
45+
model_name='report',
46+
name='location_choice',
47+
field=models.CharField(choices=[('current', "Current location detected by user's device"), ('selected', 'Location selected by user from map'), ('missing', 'No location choice submitted - should be used only for missions')], help_text="Did user indicate that report relates to current location of phone ('current') or to a location selected manually on the map ('selected')? Or is the choice missing ('missing')", max_length=8),
48+
),
49+
migrations.AlterField(
50+
model_name='report',
51+
name='os',
52+
field=models.CharField(blank=True, help_text='Operating system of device from which this report was submitted.', max_length=200, null=True),
53+
),
54+
migrations.AlterField(
55+
model_name='report',
56+
name='os_language',
57+
field=models.CharField(blank=True, help_text='Language setting of operating system on device from which this report was submitted. 2-digit ISO-639-1 language code.', max_length=10, null=True),
58+
),
59+
migrations.AlterField(
60+
model_name='report',
61+
name='os_version',
62+
field=models.CharField(blank=True, help_text='Operating system version of device from which this report was submitted.', max_length=200, null=True),
63+
),
64+
migrations.AlterField(
65+
model_name='report',
66+
name='package_name',
67+
field=models.CharField(blank=True, db_index=True, help_text='Name of tigatrapp package from which this report was submitted.', max_length=400, null=True),
68+
),
69+
migrations.AlterField(
70+
model_name='report',
71+
name='phone_upload_time',
72+
field=models.DateTimeField(help_text="Date and time on phone when it uploaded fix. Format as ECMA 262 date time string (e.g. '2014-05-17T12:34:56.123+01:00'."),
73+
),
74+
migrations.AlterField(
75+
model_name='report',
76+
name='session',
77+
field=models.ForeignKey(blank=True, help_text='Session ID for session in which this report was created', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='session_reports', to='tigaserver_app.Session'),
78+
),
79+
migrations.AlterField(
80+
model_name='report',
81+
name='version_time',
82+
field=models.DateTimeField(help_text="Date and time on phone when this version of report was created. Format as ECMA 262 date time string (e.g. '2014-05-17T12:34:56.123+01:00'."),
83+
),
84+
]

0 commit comments

Comments
 (0)