diff --git a/DOSPORTAL/models.py b/DOSPORTAL/models.py
index 9d771bc..b8a25cc 100644
--- a/DOSPORTAL/models.py
+++ b/DOSPORTAL/models.py
@@ -249,6 +249,9 @@ def __str__(self) -> str:
def description_formatted(self):
return markdownify(self.description)
+ @property
+ def formatted_label(self):
+ return f""" {self.name}"""
diff --git a/DOSPORTAL/signals.py b/DOSPORTAL/signals.py
index 5c744f3..833289d 100644
--- a/DOSPORTAL/signals.py
+++ b/DOSPORTAL/signals.py
@@ -92,7 +92,8 @@ def save_record(sender, instance, created = None, **kwargs):
new_columns = ['time'] + list(range(df_spectrum.shape[1] - 1))
df_spectrum.columns = new_columns
- duration = df_spectrum['time'].max()
+ df_spectrum['time'] = df_spectrum['time'].astype(float)
+ duration = df_spectrum['time'].max() - df_spectrum['time'].min()
instance.record_duration = datetime.timedelta(seconds=float(duration))
new_name = instance.user_directory_path_data('pk')
diff --git a/DOSPORTAL/templates/detectors/detectors_detail.html b/DOSPORTAL/templates/detectors/detectors_detail.html
index 406b43c..5039f97 100644
--- a/DOSPORTAL/templates/detectors/detectors_detail.html
+++ b/DOSPORTAL/templates/detectors/detectors_detail.html
@@ -27,16 +27,19 @@
{%endif%}
- - Serial number: {{ detector.sn }}
-
- Type: {{ detector.type }}
-
- Advanced metadata:
+ - Serial number: {{detector.sn}}
+
- Type: {{ detector.type.formatted_label|safe }}
+ {% comment %}
- Advanced metadata:
{% endcomment}
{{detector.data}}
- - Measurements conducted with this detector:
-
+
+ {% comment %}
+
- Measurements conducted with this detector:
+
+ {% endcomment %}
- Records created with this detector:
diff --git a/DOSPORTAL/templates/organizations/organization_profile.html b/DOSPORTAL/templates/organizations/organization_profile.html
index 1224f1f..5c57843 100644
--- a/DOSPORTAL/templates/organizations/organization_profile.html
+++ b/DOSPORTAL/templates/organizations/organization_profile.html
@@ -19,8 +19,6 @@
{% endfor %}
-
-
@@ -31,6 +29,8 @@ Detectors
{{detector}}
{% endfor %}
+
+{% comment %}
Maintainer of detectors:
@@ -39,6 +39,7 @@ Maintainer of detectors:
Author of measurements
TODO:
+{% endcomment %}
diff --git a/DOSPORTAL/templates/records/record_detail.html b/DOSPORTAL/templates/records/record_detail.html
index 6b2bdc6..e89359c 100644
--- a/DOSPORTAL/templates/records/record_detail.html
+++ b/DOSPORTAL/templates/records/record_detail.html
@@ -56,12 +56,13 @@
{{record.log_original_filename}} ({{ record.log_file | filesize_mb }}) |
{% if record.description|length > 1 %}
Description: |
- {{record.formatted_markdown | safe }} |
+ {{record.formatted_markdown }} |
{% endif %}
{% if record.metadata|length > 4 %}
Advanced metadata: |
- {{record.metadata}})
|
+
+ {{record.metadata|pretty_json|safe }})
|
{% endif %}
diff --git a/DOSPORTAL/templatetags/filters.py b/DOSPORTAL/templatetags/filters.py
index 18667bf..3e56260 100644
--- a/DOSPORTAL/templatetags/filters.py
+++ b/DOSPORTAL/templatetags/filters.py
@@ -1,4 +1,5 @@
from django import template
+import json
register = template.Library()
@@ -6,3 +7,12 @@
def filesize_mb(value):
"""Převede velikost souboru na megabajty."""
return f"{value.size / (1024 * 1024):.2f} MB"
+
+@register.filter(name='pretty_json')
+def pretty_json(value):
+ val = json.loads(value)
+ val = json.dumps(val, indent=4, ensure_ascii=False, sort_keys=True)
+ val = val.replace(' ', ' ')
+ val = val.replace('\n', '
')
+
+ return val
\ No newline at end of file