set frequency unit in yml files

This commit is contained in:
Wolfgang 2024-06-02 12:40:00 +02:00
parent 277d04d8cb
commit fa5b385d2d
3 changed files with 6 additions and 3 deletions

View file

@ -7,6 +7,7 @@
status: Status, status: Status,
conditions: Conditions conditions: Conditions
} }
frequency_unit: kHz
comments: comments:
- Status: "P: Primär dem Amateurfunk zugewiesen, P+: Primär (weitgehend exklusiv) dem Amateurfunk zugewiesen, S: Sekundär dem Amateurfunk zugewiesen" - Status: "P: Primär dem Amateurfunk zugewiesen, P+: Primär (weitgehend exklusiv) dem Amateurfunk zugewiesen, S: Sekundär dem Amateurfunk zugewiesen"
- Conditions: ' - Conditions: '

View file

@ -8,6 +8,7 @@
bandwidth: Bandwidth / Hz, bandwidth: Bandwidth / Hz,
description: Description description: Description
} }
frequency_unit: kHz
comments: comments:
- Source Base: '<a href="https://www.iaru-r1.org/wp-content/uploads/2021/06/hf_r1_bandplan.pdf">https://www.iaru-r1.org/wp-content/uploads/2021/06/hf_r1_bandplan.pdf</a>' - Source Base: '<a href="https://www.iaru-r1.org/wp-content/uploads/2021/06/hf_r1_bandplan.pdf">https://www.iaru-r1.org/wp-content/uploads/2021/06/hf_r1_bandplan.pdf</a>'
- Source Base Date: "2021-06-09" - Source Base Date: "2021-06-09"

View file

@ -26,6 +26,7 @@ div>label {
<link href="https://unpkg.com/tabulator-tables/dist/css/tabulator.min.css" rel="stylesheet"> <link href="https://unpkg.com/tabulator-tables/dist/css/tabulator.min.css" rel="stylesheet">
<script src="https://unpkg.com/browser-cjs/require.min.js"></script> <script src="https://unpkg.com/browser-cjs/require.min.js"></script>
<script src="https://unpkg.com/tabulator-tables/dist/js/tabulator.min.js"></script> <script src="https://unpkg.com/tabulator-tables/dist/js/tabulator.min.js"></script>
<script src="https://unpkg.com/js-quantities/build/quantities.js"></script>
<!-- <!--
for pdf saving for pdf saving
<script src="https://unpkg.com/jspdf/dist/jspdf.umd.min.js"></script> <script src="https://unpkg.com/jspdf/dist/jspdf.umd.min.js"></script>
@ -37,8 +38,6 @@ div>label {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
const yaml = require("https://unpkg.com/js-yaml/dist/js-yaml.min.js"); const yaml = require("https://unpkg.com/js-yaml/dist/js-yaml.min.js");
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
const Measures = require("https://unpkg.com/measures/dist/measures.cjs.js");
// eslint-disable-next-line no-undef
const path = require("https://unpkg.com/path-browserify/index.js"); const path = require("https://unpkg.com/path-browserify/index.js");
function create_element_link(element, href) { function create_element_link(element, href) {
@ -185,6 +184,8 @@ div>label {
add_column(row, base, header["base"]); add_column(row, base, header["base"]);
let [ext_start, ext_end] = ext.frequency.split("-"); let [ext_start, ext_end] = ext.frequency.split("-");
ext_start = Qty(Number(ext_start), header["extension"].frequency_unit).to(header["base"].frequency_unit).scalar;
ext_end = Qty(Number(ext_end), header["extension"].frequency_unit).to(header["base"].frequency_unit).scalar;
if (typeof base.frequency === "number") { if (typeof base.frequency === "number") {
// at single frequency // at single frequency
if (isInRange(base.frequency, ext_start, ext_end)) { if (isInRange(base.frequency, ext_start, ext_end)) {
@ -279,7 +280,7 @@ div>label {
definitions.forEach((column) => { definitions.forEach((column) => {
if (column.field == "band") { if (column.field == "band") {
column.sorter = function(a, b) { column.sorter = function(a, b) {
return parseFloat(new Measures().from(a).to("m")) - parseFloat(new Measures().from(b).to("m")); return Qty(a).sub(Qty(b)).toBase().scalar;
} }
} }