MagicMirrorOrg / MagicMirror

MagicMirror² is an open source modular smart mirror platform. With a growing list of installable modules, the MagicMirror² allows you to convert your hallway or bathroom mirror into your personal assistant.
http://magicmirror.builders
MIT License
19.84k stars 4.21k forks source link

Enhance compliments remote file with refresh support #3630

Closed sdetweil closed 1 week ago

sdetweil commented 2 weeks ago

add support to refresh the compliments remotefile add testcases for both without refresh (testcase missing) and with refresh

doc to be updated

sdetweil commented 2 weeks ago

runner step check needs a fix if branch is changed to develop it doesn't get it, rest of steps correct

khassel commented 2 weeks ago

@rejas have we a problem with linting?

This PR contains stuff where I would expect linting errors but there are none.

sdetweil commented 2 weeks ago

i left code in so we could resolve the problem window.name is empty

sdetweil commented 2 weeks ago

speaking of lint problems.

if I run test:js or lint:js I see this

npm run test:js

> magicmirror@2.30.0-develop test:js
> eslint .

/home/sam/MagicMirror/js/es.js
  15:7  error  Parsing error: 'return' outside of function

/home/sam/MagicMirror/tests/configs/port_variable.js
  3:1  error  Parsing error: Unexpected token }
sdetweil commented 2 weeks ago

test mode detection fixed in #3631

sdetweil commented 2 weeks ago

oops.. implemented minimum delay before intest #3631 incorporated

sdetweil commented 2 weeks ago

added documentation update

rejas commented 1 week ago

I merged your doc update already, what is to be done here @sdetweil ?

rejas commented 1 week ago

@rejas have we a problem with linting?

This PR contains stuff where I would expect linting errors but there are none.

I dont get any errors anymore, so probably fixed?

sdetweil commented 1 week ago

i need to change the code here to match the test mode detection in #3631

i wouldn't have merged the doc update til this was merged.

sdetweil commented 1 week ago

fails waiting for #3631

sdetweil commented 1 week ago

ready for review

khassel commented 1 week ago

I dont get any errors anymore, so probably fixed?

@rejas not fixed, an example:

diff --git a/modules/default/compliments/compliments.js b/modules/default/compliments/compliments.js
index 7b4be902..b76713fb 100644
--- a/modules/default/compliments/compliments.js
+++ b/modules/default/compliments/compliments.js
@@ -20,24 +20,25 @@ Module.register("compliments", {
                afternoonStartTime: 12,
                afternoonEndTime: 17,
                random: true,
-               specialDayUnique: false,
+               specialDayUnique: false
        },
-       urlSuffix:"",
-       compliments_new:null,
-       refreshMinimumDelay:15*60*60*1000,  // 15 minutes
+       urlSuffix: "",
+       compliments_new: null,
+       refreshMinimumDelay: 15 * 60 * 60 * 1000, // 15 minutes
        lastIndexUsed: -1,
        // Set currentweather from module
sdetweil commented 1 week ago

and the two i posted above

npm run test:js

khassel commented 1 week ago

@sdetweil can you please merge develop into this (or rebase) and fix the (upcoming) lint errors? Thanks!

sdetweil commented 1 week ago

it was built on develop... i just didn't pick develop on submission

khassel commented 1 week ago

develop was updated, we need the newest version here to get correct linting

sdetweil commented 1 week ago

yes, updated, repushed

sdetweil commented 1 week ago

lint broken now

KristjanESPERANTO commented 1 week ago

lint broken now

Most of the issues should be fixable by npm run lint:js.

sdetweil commented 1 week ago

not ..

now, I have personal files in the MM folders that don't pass the lint tests and its none of the linters business.. but they are rejected

> magicmirror@2.30.0-develop lint:js
> eslint . --fix

/home/sam/MagicMirror.old/js/es.js
  15:7  error  Parsing error: 'return' outside of function

/home/sam/MagicMirror.old/modules/default/calendar/save/calendarfetcherutils.js
  120:2   warning  Method 'filterEvents' has too many lines (518). Maximum allowed is 400     max-lines-per-function
  145:32  warning  Arrow function has too many lines (486). Maximum allowed is 400            max-lines-per-function
  299:23  error    Expected '!==' and instead saw '!='                                        eqeqeq
  306:19  error    Expected '!==' and instead saw '!='                                        eqeqeq
  325:10  error    Unexpected constant condition                                              no-constant-condition
  336:19  error    Expected '!==' and instead saw '!='                                        eqeqeq
  349:10  error    Unexpected constant condition                                              no-constant-condition
  349:10  error    Unexpected constant truthiness on the left-hand side of a `&&` expression  no-constant-binary-expression
  415:59  error    Unexpected comma in middle of array                                        no-sparse-arrays
  443:40  error    Expected '!==' and instead saw '!='                                        eqeqeq
  488:19  error    Expected '!==' and instead saw '!='                                        eqeqeq
  490:31  error    Expected '!==' and instead saw '!='                                        eqeqeq
  497:32  error    Expected '===' and instead saw '=='                                        eqeqeq
  507:34  error    Expected '===' and instead saw '=='                                        eqeqeq
  524:11  error    Expected no linebreak before this statement                                @stylistic/nonblock-statement-body-position
  527:11  error    Expected no linebreak before this statement                                @stylistic/nonblock-statement-body-position
  527:23  error    'eventDiff' is assigned to itself                                          no-self-assign

/home/sam/MagicMirror.old/modules/default/calendar/testrrule.js
  9:38  error  Parsing error: Invalid number

/home/sam/MagicMirror.old/modules/default/textit.js
  20:17  error  Parsing error: Unexpected token function

/home/sam/MagicMirror.old/tests/configs/port_variable.js
  3:1  error  Parsing error: Unexpected token }

leave me alone!

I think THIS is a lint error

this.config.remoteFileRefreshInterval !== 0 forcing !== for a numeric value, there is no ambiguity

khassel commented 1 week ago

leave me alone!

I knew you would like it ;)