Skip to content

Commit

Permalink
unknown changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikbondesson committed Apr 20, 2024
1 parent e709b58 commit b242b4c
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 66 deletions.
4 changes: 4 additions & 0 deletions abro.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
<br>
<a href="http://www.temperatur.nu/kallered_backen.html">Vaderstation Kallered/Backen</a>
<script type="text/javascript" src="http://www.temperatur.nu/jstemp.php?s=kallered_backen"></script>
<br>
<a href="http://www.temperatur.nu/kallered_backen.html">Vaderstation Goteborg/Lindome2</a>
<script type="text/javascript" src="http://www.temperatur.nu/jstemp.php?s=lindome2"></script>


<br>
<a href="https://rl.se/goteborg">rl.se for Goteborg</a>
Expand Down
140 changes: 74 additions & 66 deletions ute_5637624.html
Original file line number Diff line number Diff line change
Expand Up @@ -376,85 +376,93 @@ <h2>UtomhusMaxMinMedel</h2>
start_date = "";
end_date = ""

prev_timestamp = "";

//console.log(content);
for (index = 1; index < content.length; ++index) {
// Formatted as 2023-10-27 00:59:07,4.8
if (content[index] != "") {
timestamp_value = content[index].split(',');
date_time = timestamp_value[0].split(" ");
value = parseFloat(timestamp_value[1])
date = date_time[0];
year_month_day = date.split("-");

year = year_month_day[0]
month = year_month_day[1]

// Store all values? Or calculate what we want instead
//localStorage.setItem(date_time, value);
//console.log(content[index]);
//console.log("MONTH " + month + " PREV_MONTH" + prev_month);
if (month != prev_month) {
if (monthly_count != 0) {
monthly_average = monthly_values / monthly_count;
//monthly_average = monthly_average.toFixed(2); // toFixed converts to string
//console.log("AAAAAAAAAAAAAAAAAAAAAAAdd monthly");
//console.log(year + prev_month, [monthly_min, monthly_average, monthly_max]);
localStorage.setItem(prev_year + prev_month, [monthly_min, monthly_average, monthly_max])

monthly_average = 0;
monthly_count = 0;
monthly_max = -100;
monthly_min = 100;
monthly_values = 0;
timestamp = timestamp_value[0]
if (timestamp != prev_timestamp) {
prev_timestamp = timestamp
date_time = timestamp_value[0].split(" ");
value = parseFloat(timestamp_value[1])
date = date_time[0];
year_month_day = date.split("-");

year = year_month_day[0]
month = year_month_day[1]

// Store all values? Or calculate what we want instead
//localStorage.setItem(date_time, value);
//console.log(content[index]);
//console.log("MONTH " + month + " PREV_MONTH" + prev_month);
if (month != prev_month) {
if (monthly_count != 0) {
monthly_average = monthly_values / monthly_count;
//monthly_average = monthly_average.toFixed(2); // toFixed converts to string
//console.log("AAAAAAAAAAAAAAAAAAAAAAAdd monthly");
//console.log(year + prev_month, [monthly_min, monthly_average, monthly_max]);
localStorage.setItem(prev_year + prev_month, [monthly_min, monthly_average, monthly_max])

monthly_average = 0;
monthly_count = 0;
monthly_max = -100;
monthly_min = 100;
monthly_values = 0;
}
prev_month = month;
prev_year = year;
}
prev_month = month;
prev_year = year;
}
monthly_values = monthly_values + value;
monthly_count = monthly_count + 1;
monthly_values = monthly_values + value;
monthly_count = monthly_count + 1;

if (value > monthly_max) {
monthly_max = value;
}
if (value < monthly_min) {
monthly_min = value;
}
if (value > monthly_max) {
monthly_max = value;
}
if (value < monthly_min) {
monthly_min = value;
}

if (year == "2023" && month == "06") {
//console.log("MONTHY " + date + " value=" + value + " max = " + monthly_max + " min = " + monthly_min);
}
if (year == "2023" && month == "06") {
//console.log("MONTHY " + date + " value=" + value + " max = " + monthly_max + " min = " + monthly_min);
}

if (date != prev_date) {
if (count != 0) {
average = values / count;
//average = average.toFixed(2);
//console.log("Average:" + values + " count " + count);
//console.log(prev_date, min + ";" + average + ";" + max + "\n")
localStorage.setItem(prev_date, min + ";" + average + ";" + max + "\n")
average = 0;
count = 0;
max = -100;
min = 100;
values = 0;
if (date != prev_date) {
if (count != 0) {
average = values / count;
//average = average.toFixed(2);
//console.log("Average:" + values + " count " + count);
//console.log(prev_date, min + ";" + average + ";" + max + "\n")
localStorage.setItem(prev_date, min + ";" + average + ";" + max + "\n")
average = 0;
count = 0;
max = -100;
min = 100;
values = 0;
}
prev_date = date;
}
prev_date = date;
}

if (start_date == "") {
start_date = date;
}
end_date = date;
if (start_date == "") {
start_date = date;
}
end_date = date;

if (value > max) {
max = value;
}
if (value < min) {
min = value;
}
if (value > max) {
max = value;
}
if (value < min) {
min = value;
}

values = values + value;
count = count + 1;
//console.log("Add " + date + " " + value);
values = values + value;
count = count + 1;
//console.log("Add " + date + " " + value);
} else {
console.log("Same timestamp " + timestamp + " " + prev_timestamp);
}
}
}

Expand Down

0 comments on commit b242b4c

Please sign in to comment.