Skip to content

Commit b16d179

Browse files
committed
🛠️ src/signals/models.py -> Added same_base_signals property
🛠️ src/templates/signals/signal_detail.html -> Added section for same base signals 🛠️ src/templates/signals/signals.html -> Fixed indentation
1 parent 5c48bff commit b16d179

File tree

3 files changed

+65
-1
lines changed

3 files changed

+65
-1
lines changed

src/signals/models.py

+7
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,13 @@ def example_url(self):
302302
example_url = self.links.filter(link_type="example_url").first()
303303
return example_url.url if example_url else None
304304

305+
@property
306+
def same_base_signals(self):
307+
"""
308+
Returns the signals that have the same base signal.
309+
"""
310+
return self.base.base_for.all() if self.base else None
311+
305312
class Meta:
306313
unique_together = ['name', 'source']
307314
ordering: list[str] = ["modified"]

src/templates/signals/signal_detail.html

+57
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,63 @@ <h5>About this signal</h5>
207207
</div>
208208
</div>
209209
</section>
210+
{% if signal.base %}
211+
<h5>Signals with same base</h5>
212+
<section class="section">
213+
<div class="row">
214+
<div class="card">
215+
<div class="card-body">
216+
<table class="table table-borderless table-hover">
217+
<thead>
218+
<tr>
219+
<th scope="col">Name</th>
220+
<th scope="col">Active</th>
221+
<th scope="col">Data Source</th>
222+
<th scope="col">Description</th>
223+
<th scope="col">Pathogen/Disease Area</th>
224+
<th scope="col">Base Signal</th>
225+
<th scope="col">Last Updated</th>
226+
</tr>
227+
</thead>
228+
<tbody>
229+
{% for signal in signal.same_base_signals %}
230+
<tr classs="clickable-table-row">
231+
<td onClick="location.href='{% url 'signal' pk=signal.id %}';" class="clickable-table-cell">{{ signal.display_name }}</td>
232+
{% if signal.active == True %}
233+
<td><i class="bi bi-circle-fill" style="color:green;" ></i></td>
234+
{% else %}
235+
<td><i class="bi bi-circle-fill" style="color:red;" ></i></td>
236+
{% endif %}
237+
<td>{{ signal.source.data_source }}</td>
238+
<td>{{ signal.description }}</td>
239+
<td>
240+
{% for pathogen in signal.pathogen.all %}
241+
<span class="badge rounded-pill bg-dark">{{ pathogen|title }}</span>
242+
{% endfor %}
243+
</td>
244+
<td>
245+
{% if signal.base %}
246+
<a href="{% url 'signal' pk=signal.base.id %}">{{ signal.display_name }}</a>
247+
{% else %}
248+
--/--
249+
{% endif %}
250+
</td>
251+
<td>
252+
{% if signal.last_updated %}
253+
{{ signal.last_updated|date:"Y-m-d" }}
254+
{% else %}
255+
--/--
256+
{% endif %}
257+
</td>
258+
</tr>
259+
{% endfor %}
260+
</tbody>
261+
</table>
262+
</div>
263+
</div>
264+
</div>
265+
</section>
266+
{% endif %}
210267
{% if signal.example_url != '' %}
211268
<h5>Response Example</h5>
212269
<section class="section">

src/templates/signals/signals.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ <h2 class="accordion-header" id="available_geography-heading">
277277
</table>
278278
</div>
279279
</div>
280-
</div>
280+
</div>
281281
</div>
282282
</div>
283283
</form>

0 commit comments

Comments
 (0)