mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-30 04:59:32 +00:00
Fix some more undefs that popped up out of nowhere
This commit is contained in:
parent
c8aedc6f29
commit
c8a0f1d0de
@ -82,7 +82,7 @@ WeatherProvider.register("ukmetoffice", {
|
|||||||
let timeInMins = nowUtc.diff(midnightUtc, "minutes");
|
let timeInMins = nowUtc.diff(midnightUtc, "minutes");
|
||||||
|
|
||||||
// loop round each of the (5) periods, look for today (the first period may be yesterday)
|
// loop round each of the (5) periods, look for today (the first period may be yesterday)
|
||||||
for (i in currentWeatherData.SiteRep.DV.Location.Period) {
|
for (var i in currentWeatherData.SiteRep.DV.Location.Period) {
|
||||||
let periodDate = moment.utc(currentWeatherData.SiteRep.DV.Location.Period[i].value.substr(0,10), "YYYY-MM-DD");
|
let periodDate = moment.utc(currentWeatherData.SiteRep.DV.Location.Period[i].value.substr(0,10), "YYYY-MM-DD");
|
||||||
|
|
||||||
// ignore if period is before today
|
// ignore if period is before today
|
||||||
@ -92,7 +92,7 @@ WeatherProvider.register("ukmetoffice", {
|
|||||||
if (moment().diff(periodDate, "minutes") > 0) {
|
if (moment().diff(periodDate, "minutes") > 0) {
|
||||||
// loop round the reports looking for the one we are in
|
// loop round the reports looking for the one we are in
|
||||||
// $ value specifies the time in minutes-of-the-day: 0, 180, 360,...1260
|
// $ value specifies the time in minutes-of-the-day: 0, 180, 360,...1260
|
||||||
for (j in currentWeatherData.SiteRep.DV.Location.Period[i].Rep){
|
for (var j in currentWeatherData.SiteRep.DV.Location.Period[i].Rep){
|
||||||
let p = currentWeatherData.SiteRep.DV.Location.Period[i].Rep[j].$;
|
let p = currentWeatherData.SiteRep.DV.Location.Period[i].Rep[j].$;
|
||||||
if (timeInMins >= p && timeInMins-180 < p) {
|
if (timeInMins >= p && timeInMins-180 < p) {
|
||||||
// finally got the one we want, so populate weather object
|
// finally got the one we want, so populate weather object
|
||||||
@ -126,11 +126,11 @@ WeatherProvider.register("ukmetoffice", {
|
|||||||
|
|
||||||
// loop round the (5) periods getting the data
|
// loop round the (5) periods getting the data
|
||||||
// for each period array, Day is [0], Night is [1]
|
// for each period array, Day is [0], Night is [1]
|
||||||
for (j in forecasts.SiteRep.DV.Location.Period) {
|
for (var j in forecasts.SiteRep.DV.Location.Period) {
|
||||||
const weather = new WeatherObject(this.config.units, this.config.tempUnits, this.config.windUnits);
|
const weather = new WeatherObject(this.config.units, this.config.tempUnits, this.config.windUnits);
|
||||||
|
|
||||||
// data times are always UTC
|
// data times are always UTC
|
||||||
dateStr = forecasts.SiteRep.DV.Location.Period[j].value;
|
const dateStr = forecasts.SiteRep.DV.Location.Period[j].value;
|
||||||
let periodDate = moment.utc(dateStr.substr(0,10), "YYYY-MM-DD");
|
let periodDate = moment.utc(dateStr.substr(0,10), "YYYY-MM-DD");
|
||||||
|
|
||||||
// ignore if period is before today
|
// ignore if period is before today
|
||||||
|
@ -26,7 +26,7 @@ var config = {
|
|||||||
"middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right",
|
"middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right",
|
||||||
"bottom_bar", "fullscreen_above", "fullscreen_below"];
|
"bottom_bar", "fullscreen_above", "fullscreen_below"];
|
||||||
var modules = Array();
|
var modules = Array();
|
||||||
for (idx in positions) {
|
for (var idx in positions) {
|
||||||
modules.push({
|
modules.push({
|
||||||
module: "helloworld",
|
module: "helloworld",
|
||||||
position: positions[idx],
|
position: positions[idx],
|
||||||
|
@ -17,7 +17,7 @@ describe("Functions into modules/default/calendar/calendar.js", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("capFirst", function() {
|
describe("capFirst", function() {
|
||||||
words = {
|
const words = {
|
||||||
"rodrigo": "Rodrigo",
|
"rodrigo": "Rodrigo",
|
||||||
"123m": "123m",
|
"123m": "123m",
|
||||||
"magic mirror": "Magic mirror",
|
"magic mirror": "Magic mirror",
|
||||||
@ -89,7 +89,7 @@ describe("Functions into modules/default/calendar/calendar.js", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("shorten", function() {
|
describe("shorten", function() {
|
||||||
strings = {
|
const strings = {
|
||||||
" String with whitespace at the beginning that needs trimming" : { length: 16, return: "String with whit…" },
|
" String with whitespace at the beginning that needs trimming" : { length: 16, return: "String with whit…" },
|
||||||
"long string that needs shortening": { length: 16, return: "long string that…" },
|
"long string that needs shortening": { length: 16, return: "long string that…" },
|
||||||
"short string": { length: 16, return: "short string" },
|
"short string": { length: 16, return: "short string" },
|
||||||
|
@ -12,7 +12,7 @@ describe("Functions into modules/default/newsfeed/newsfeed.js", function() {
|
|||||||
require("../../../modules/default/newsfeed/newsfeed.js");
|
require("../../../modules/default/newsfeed/newsfeed.js");
|
||||||
|
|
||||||
describe("capitalizeFirstLetter", function() {
|
describe("capitalizeFirstLetter", function() {
|
||||||
words = {
|
const words = {
|
||||||
"rodrigo": "Rodrigo",
|
"rodrigo": "Rodrigo",
|
||||||
"123m": "123m",
|
"123m": "123m",
|
||||||
"magic mirror": "Magic mirror",
|
"magic mirror": "Magic mirror",
|
||||||
|
@ -62,7 +62,7 @@ describe("'global.root_path' set in js/app.js", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should expect the global.version equals package.json file", function() {
|
it("should expect the global.version equals package.json file", function() {
|
||||||
versionPackage = JSON.parse(fs.readFileSync("package.json", "utf8")).version;
|
const versionPackage = JSON.parse(fs.readFileSync("package.json", "utf8")).version;
|
||||||
expect(this.sandbox.global.version).to.equal(versionPackage);
|
expect(this.sandbox.global.version).to.equal(versionPackage);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user