Skip to content

Commit 955591c

Browse files
authored
Merge branch 'development' into OKRS24-165
2 parents f851243 + 176bd87 commit 955591c

File tree

9 files changed

+66
-34
lines changed

9 files changed

+66
-34
lines changed

src/assets/css/custom.css

+4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@
6767
padding: 0;
6868
}
6969

70+
.pt-05 {
71+
padding-top: 0.5rem;
72+
}
73+
7074
.border-left {
7175
border-left: 1px solid #e4e4e4;
7276
}

src/fixtures/nation.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[
2+
{
3+
"model": "signals.geographyunit",
4+
"pk": 3985,
5+
"fields": {
6+
"created": "2024-05-27T13:52:04.705Z",
7+
"modified": "2024-05-27T13:52:04.705Z",
8+
"geo_id": "US",
9+
"name": "United States",
10+
"display_name": "United States",
11+
"level": 5,
12+
"geography": 5
13+
}
14+
}
15+
]

src/signal_documentation/settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949

5050
# SECURITY WARNING: don't run with debug turned on in production!
51-
DEBUG = True
51+
DEBUG = bool(strtobool(os.getenv('DEBUG', 'True')))
5252

5353

5454
# SECURITY WARNING: keep the secret key used in production secret!

src/signals/filters.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from signals.models import (
1515
FormatChoices,
1616
Signal,
17-
TimeLabelChoices,
17+
TimeTypeChoices,
1818
)
1919

2020

@@ -42,7 +42,7 @@ class SignalFilter(django_filters.FilterSet):
4242
)
4343
format_type = django_filters.MultipleChoiceFilter(choices=FormatChoices.choices)
4444
source = django_filters.ModelMultipleChoiceFilter(queryset=SourceSubdivision.objects.all())
45-
time_label = django_filters.MultipleChoiceFilter(choices=TimeLabelChoices.choices)
45+
time_type = django_filters.MultipleChoiceFilter(choices=TimeTypeChoices.choices)
4646

4747
class Meta:
4848
model = Signal
@@ -56,7 +56,7 @@ class Meta:
5656
'category',
5757
'format_type',
5858
'source',
59-
'time_label',
59+
'time_type',
6060
]
6161

6262
def filter_search(self, queryset, name, value) -> Any:

src/signals/forms.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
FormatChoices,
88
Pathogen,
99
Signal,
10-
TimeLabelChoices,
10+
TimeTypeChoices,
1111
)
1212

1313

@@ -29,7 +29,7 @@ class SignalFilterForm(forms.ModelForm):
2929
active = forms.TypedMultipleChoiceField(choices=ActiveChoices.choices, coerce=bool, widget=forms.CheckboxSelectMultiple())
3030
format_type = forms.ChoiceField(choices=FormatChoices.choices, widget=forms.CheckboxSelectMultiple())
3131
source = forms.ModelMultipleChoiceField(queryset=SourceSubdivision.objects.all(), widget=forms.CheckboxSelectMultiple())
32-
time_label = forms.ChoiceField(choices=TimeLabelChoices.choices, widget=forms.CheckboxSelectMultiple())
32+
time_type = forms.ChoiceField(choices=TimeTypeChoices.choices, widget=forms.CheckboxSelectMultiple())
3333

3434
class Meta:
3535
model = Signal
@@ -44,7 +44,7 @@ class Meta:
4444
'format_type',
4545
'signal_type',
4646
'source',
47-
'time_label',
47+
'time_type',
4848
]
4949

5050
widgets = {

src/signals/views.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def get_url_params(self):
5353
else None,
5454
"format_type": [el for el in self.request.GET.getlist("format_type")],
5555
"source": [int(el) for el in self.request.GET.getlist("source")],
56-
"time_label": [el for el in self.request.GET.getlist("time_label")]
56+
"time_type": [el for el in self.request.GET.getlist("time_type")]
5757
}
5858
url_params_str = ""
5959
for param_name, param_value in url_params_dict.items():

src/templates/signals/epivis_export_data_block.html

+9-6
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ <h5>Plot / Export data</h5>
106106
<script>
107107
var geoValues = [];
108108
var currentMode = 'epivis';
109-
109+
110110
function getFilteredGeographicValues(geographicType) {
111111
var data = geoValues.reduce((data, geoValue) => {
112112
if (geoValue.geoType === geographicType) {
@@ -130,7 +130,7 @@ <h5>Plot / Export data</h5>
130130
} else {
131131
data = [];
132132
}
133-
133+
134134

135135
$('#geographic_value').select2({
136136
data: data,
@@ -146,7 +146,7 @@ <h5>Plot / Export data</h5>
146146

147147
function handleModeChange(mode) {
148148
document.getElementById("epivis-form").reset();
149-
149+
150150
var choose_dates = document.getElementsByName('choose_date');
151151
if (mode === 'epivis') {
152152
currentMode = 'epivis';
@@ -179,7 +179,7 @@ <h5>Plot / Export data</h5>
179179
$(document).ready(function () {
180180
{% for geography in signal.available_geography.all %}
181181
{% for unit in geography.geography_units.all %}
182-
geoValues.push({'id': '{{ unit.geo_id }}', 'geoType': '{{ unit.geography }}', 'text': '{{ unit.display_name }}'});
182+
geoValues.push({'id': '{{ unit.geo_id }}', 'geoType': '{{ unit.geography }}', 'text': '{{ unit.display_name }}'});
183183
{% endfor %}
184184
{% endfor %}
185185

@@ -201,11 +201,14 @@ <h5>Plot / Export data</h5>
201201

202202
function submitMode(event) {
203203
event.preventDefault();
204-
204+
205205
var dataSource = document.getElementById('source').value;
206206
var dataSignal = document.getElementById('signal').value;
207207
var geographicType = document.getElementById('geographic_type').value;
208-
var geographicValue = $('#geographic_value').select2('data').map((el) => el.id).join(',');
208+
// geographicValue is a comma separated string of geographic values. type can be string or integer
209+
// in case of string, it should be converted to lowercase
210+
// else it will be treated as integer
211+
var geographicValue = $('#geographic_value').select2('data').map((el) => (typeof el.id === 'string') ? el.id.toLowerCase() : el.id).join(',');
209212

210213
if (geographicType === 'Choose...' || geographicValue === '') {
211214
showWarningAlert("Geographic Type or Geographic Value is not selected.");

src/templates/signals/signal_detail.html

+15-12
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,11 @@ <h5>About this signal</h5>
7373
<td>
7474
<ul class="no-padding">
7575
{% for pathogen in signal.pathogen.all %}
76-
<span
77-
class="badge rounded-pill bg-dark"
78-
>{{ pathogen|title }}</span
79-
>
76+
<a href="{% url 'signals' %}?pathogen={{ pathogen.id }}">
77+
<span class="badge rounded-pill bg-dark">
78+
{{ pathogen|title }}
79+
</span>
80+
</a>
8081
{% endfor %}
8182
</ul>
8283
</td>
@@ -86,10 +87,11 @@ <h5>About this signal</h5>
8687
<td>
8788
<ul class="no-padding">
8889
{% for geography in signal.available_geography.all %}
89-
<span
90-
class="badge rounded-pill bg-dark"
91-
>{{ geography }}</span
92-
>
90+
<a href="{% url 'signals' %}?available_geography={{ geography.id }}">
91+
<span class="badge rounded-pill bg-dark">
92+
{{ geography }}
93+
</span>
94+
</a>
9395
{% endfor %}
9496
</ul>
9597
</td>
@@ -99,10 +101,11 @@ <h5>About this signal</h5>
99101
<td>
100102
<ul class="no-padding">
101103
{% for signal_type in signal.signal_type.all %}
102-
<span
103-
class="badge rounded-pill bg-dark"
104-
>{{ signal_type }}</span
105-
>
104+
<a href="{% url 'signals' %}?signal_type={{ signal_type.id }}">
105+
<span class="badge rounded-pill bg-dark">
106+
{{ signal_type }}
107+
</span>
108+
</a>
106109
{% endfor %}
107110
</ul>
108111
</td>

src/templates/signals/signals.html

+15-8
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,13 @@ <h2 class="accordion-header" id="available_geography-heading">
186186
</label>
187187
</button>
188188
</h2>
189-
{% if form.time_label.value %}
190-
<div id="time_label-collapse" class="accordion-collapse" aria-labelledby="time_label-heading">
189+
{% if form.time_type.value %}
190+
<div id="time_type-collapse" class="accordion-collapse" aria-labelledby="time_type-heading">
191191
{% else %}
192-
<div id="time_label-collapse" class="accordion-collapse collapse" aria-labelledby="time_label-heading">
192+
<div id="time_type-collapse" class="accordion-collapse collapse" aria-labelledby="time_type-heading">
193193
{% endif %}
194194
<div class="accordion-body">
195-
{{ form.time_label|as_crispy_field }}
195+
{{ form.time_type|as_crispy_field }}
196196
</div>
197197
</div>
198198
</div>
@@ -207,7 +207,14 @@ <h2 class="accordion-header" id="available_geography-heading">
207207
</div>
208208
<div class="col-9">
209209
<div class="row margin-bottom-1rem d-flex justify-content-end">
210-
<div class="col-4">
210+
<div class="col-6">
211+
<div class="input-group mb-3 d-flex justify-content-start">
212+
<span class="pt-05">
213+
Showing {{ signals|length }} row{{ signals|length|pluralize:"s" }}.
214+
</span>
215+
</div>
216+
</div>
217+
<div class="col-6">
211218
<div class="input-group mb-3 d-flex justify-content-end">
212219
<label class="input-group-text form-label" for="id_order_by" id="order_by_label">Sort By</label>
213220
{{ form.order_by|as_crispy_field }}
@@ -216,7 +223,7 @@ <h2 class="accordion-header" id="available_geography-heading">
216223
</div>
217224
<div class="row">
218225
<div class="card signals-list-card no-padding">
219-
<div class="card-header d-flex justify-content-between align-items-center">
226+
<div class="card-header d-flex justify-content-between align-items-center table-responsive">
220227
<table class="table table-borderless table-hover">
221228
<thead>
222229
<tr>
@@ -243,7 +250,7 @@ <h2 class="accordion-header" id="available_geography-heading">
243250
{% else %}
244251
<td><i class="bi bi-circle-fill" style="color:red;" ></i></td>
245252
{% endif %}
246-
<td>{{ signal.source }}</td>
253+
<td>{{ signal.source.data_source }}</td>
247254
<td>{{ signal.description }}</td>
248255
<td>
249256
{% for pathogen in signal.pathogen.all %}
@@ -252,7 +259,7 @@ <h2 class="accordion-header" id="available_geography-heading">
252259
</td>
253260
<td>
254261
{% if signal.base %}
255-
<a href="{% url 'signal' pk=signal.base.id %}">{{ signal.base.id }}</a>
262+
<a href="{% url 'signal' pk=signal.base.id %}">{{ signal.display_name }}</a>
256263
{% else %}
257264
--/--
258265
{% endif %}

0 commit comments

Comments
 (0)