• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Modul CalendarExt3Agenda

Scheduled Pinned Locked Moved Solved Troubleshooting
12 Posts 3 Posters 1.6k Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    Old_Death
    last edited by sdetweil Apr 30, 2024, 3:44 PM Apr 30, 2024, 3:21 PM

    Hello,
    I would like to combine the two functions eventFilter and eventTransform.
    Here is the example:

    eventFilter: (ev) => {
    if (ev.title.search(“Natalia:”)) return false
    return true
    },
    eventTransform: (ev) => {
    if (ev.title.search(“Natalia:”) > -1) ev.title=ev.title.replace(“Natalia:”,“”);
    return ev
    }

    But only the first function (Filter) works, but not the second (Transform)

    Can someone please help me with this?
    Thanks

    M 1 Reply Last reply Apr 30, 2024, 10:33 PM Reply Quote 0
    • O Offline
      Old_Death @MMRIZE
      last edited by May 2, 2024, 3:41 PM

      @MMRIZE Thank you very much, it works now!

      1 Reply Last reply Reply Quote 0
      • M Offline
        MMRIZE @Old_Death
        last edited by Apr 30, 2024, 10:33 PM

        @Old_Death
        It is contradiction. You can’t do both thing - drop the event or replace the title at same time. What is your purpose? (And filtering is executed primarily than transforming)

        1 Reply Last reply Reply Quote 0
        • O Offline
          Old_Death
          last edited by May 1, 2024, 4:46 AM

          I only want the dates to be shown with the title “Natalia”. These titles should then be changed. The text “Natalia” should be removed here.

          M 4 Replies Last reply May 1, 2024, 1:22 PM Reply Quote 0
          • M Offline
            MMRIZE @Old_Death
            last edited by MMRIZE May 1, 2024, 1:23 PM May 1, 2024, 1:22 PM

            @Old_Death
            You want;

            1. Only events which have title “Natalia” would be shown, others should be filtered out.
            2. Then the event (with title “Natalia”) should change its title. Right?
            1 Reply Last reply Reply Quote 0
            • M Offline
              MMRIZE @Old_Death
              last edited by MMRIZE May 1, 2024, 1:37 PM May 1, 2024, 1:34 PM

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • M Offline
                MMRIZE @Old_Death
                last edited by May 1, 2024, 1:55 PM

                @Old_Death
                Sorry, there was a bug that filtering or transforming performs twice, I’ll fix it soon.

                1 Reply Last reply Reply Quote 0
                • M Offline
                  MMRIZE @Old_Death
                  last edited by May 1, 2024, 4:11 PM

                  @Old_Death
                  I updated it to 1.4.4. Please update or reinstall the module.
                  I found a bug about twice applying the user event filter/transformer on the drawing miniMonth and agenda board.
                  However, that is not the real reason for your symptoms. You just made a mistake on your filtering. (You drop out “Natalia” events by filtering, so they were not able to be transformed.)

                  Anyway, here is my example.

                  eventFilter: (ev) => {
                  	return (ev.title.search('Test') > -1)
                  },
                  eventTransformer: (ev) => {
                  	ev.title = ev.title.replace('Test', '@')
                  	return ev
                  }
                  

                  This code means

                  1. Filter out all other events except the event which has Test in the title.
                  2. Then transform Test to @.

                  You can see the result below;

                  ORIGINAL
                  21e51508-cc39-4d7c-b4e3-26bf529fffa3-image.png

                  CONFIGURED
                  110dc1c0-e375-4fe4-afc7-aa69228d9636-image.png

                  O 2 Replies Last reply May 2, 2024, 12:28 PM Reply Quote 0
                  • O Offline
                    Old_Death @MMRIZE
                    last edited by sdetweil May 2, 2024, 12:30 PM May 2, 2024, 12:28 PM

                    @MMRIZE
                    thanks for the answer and the patch.

                    I installed this, but unfortunately there was no improvement in the result.
                    If I enter it like in the example, there are no more entries.

                    The points for the appointments are only displayed correctly in the mini calendar.

                    Here is my config for the module.

                    {
                          module: "MMM-CalendarExt3Agenda",
                          carouselId: "Seite2",
                          position: "top_left",
                          header: "Natalia",
                          config: {
                          instanceId: "basicCalendar",
                          locale: 'de-DE',
                          firstDayOfWeek: 1,
                          startDayIndex: -1,
                    		  endDayIndex: 15,
                          onlyEventDays: 15,
                          eventFilter: (ev) => {
                    	         return (ev.title.search("Natalia:") > -1)
                          },
                          eventTransformer: (ev) => {
                    	         ev.title = ev.title.replace("Natalia:", "")
                    	         return ev
                         }
                         }
                         },
                    
                    M 1 Reply Last reply May 2, 2024, 1:29 PM Reply Quote 0
                    • O Offline
                      Old_Death @MMRIZE
                      last edited by May 2, 2024, 12:30 PM

                      @MMRIZE said in Modul CalendarExt3Agenda:

                      ’
                      I also have a fundamental question of understanding.
                      The ’ character is used in the examples here.
                      I have to use the character " for it to work.
                      Why is that?

                      S 1 Reply Last reply May 2, 2024, 12:34 PM Reply Quote 0
                      • S Offline
                        sdetweil @Old_Death
                        last edited by sdetweil May 2, 2024, 12:38 PM May 2, 2024, 12:34 PM

                        @Old_Death I’m javascript, both the single and double quotes are acceptable

                        note. sometimes in the forum if the text is not in a code block, these characters are shown as word processing form , curved, like this
                        ’
                        or
                        "
                        Instead of the text form

                        ' or "
                        

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 1 / 2
                        1 / 2
                        • First post
                          6/12
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Sam, technical setup by Karsten.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy