When two nodes have the exact same date and time, only one results is shown in calendar

Created on 15 May 2023, over 1 year ago
Updated 11 September 2023, over 1 year ago

Hello,

I'm not sure if this is a bug, but when trying to build a calendar with nodes having the exact same created date and time (including seconds) the calendar is displaying only one result. There's no problem to have them all listed in a table or other format.

The view is very simple, no relationship, no aggregation, only a date field (the date when the node was created).

Does anyone have this problem or is just me?

Thank you!

๐Ÿ’ฌ Support request
Status

Fixed

Version

2.1

Component

Miscellaneous

Created by

๐Ÿ‡ท๐Ÿ‡ดRomania gge

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @gge
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia shailja179 India
  • ๐Ÿ‡จ๐Ÿ‡ดColombia angelgarciaco Bogotรก, Colombia

    Hey George

    I was reviewing and that's right. Only shows us one item if many of them have the same time (hours, minutes, seconds) I've incrememted 1 sec and then the content is shown in the calendar.

    So, you aren't the one.

  • Status changed to Needs review over 1 year ago
  • Thank you for reporting this issue.

    It's fixed in the commit above.

    Could you please test the dev branch and let me know if the situation is okay for your calendar(s)?

  • Assigned to omkar_yewale
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia omkar_yewale Mumbai
  • Issue was unassigned.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia omkar_yewale Mumbai

    Hi @matthieuscarset,

    I have verified the module 2.1.x-dev version on both Drupal 9 and Drupal 10. In the Drupal 9 version, everything functions correctly, including the exact same date and time (including seconds) nodes. However, I encountered an issue with the Drupal 10 version. When I add more than two nodes with the same date, the view does not display anything and only shows a blank page. there are no error logs recorded in the recent log either.

  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark robotjox

    I can confirm this problem.
    The dev version breaks the calendar for us (we get a white page with half a calendar and no styling), but I dont know if that is a problem on our side.

  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark robotjox

    Error with dev applied:

    Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: INSERT INTO "cache_discovery" ("cid", "expire", "created", "tags", "checksum", "data", "serialized") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6) ON DUPLICATE KEY UPDATE "cid" = VALUES("cid"), "expire" = VALUES("expire"), "created" = VALUES("created"), "tags" = VALUES("tags"), "checksum" = VALUES("checksum"), "data" = VALUES("data"), "serialized" = VALUES("serialized"); Array ( [:db_insert_placeholder_0] => views:exposed_form [:db_insert_placeholder_1] => -1 [:db_insert_placeholder_2] => 1684320047.775 [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => a:4:{s:3:"bef";a:9:{s:6:"parent";s:6:"parent";s:11:"plugin_type";s:12:"exposed_form";s:14:"register_theme";b:1;s:5:"title";O:48:"Drupal\Core\StringTranslation\TranslatableMarkup":3:{s:9:"*string";s:22:"Better Exposed Filters";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:11:"short_title";s:0:"";s:4:"help";O:48:"Drupal\Core\StringTranslation\TranslatableMarkup":3:{s:9:"*string";s:54:"Provides additional options for exposed form elements.";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:2:"id";s:3:"bef";s:5:"class";s:76:"Drupal\better_exposed_filters\Plugin\views\exposed_form\BetterExposedFilters";s:8:"provider";s:22:"better_exposed_filters";}s:10:"vefl_basic";a:9:{s:6:"parent";s:6:"parent";s:11:"plugin_type";s:12:"exposed_form";s:14:"register_theme";b:1;s:5:"title";O:48:"Drupal\Core\StringTranslation\TranslatableMarkup":3:{s:9:"*string";s:19:"Basic (with layout)";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:11:"short_title";s:0:"";s:4:"help";O:48:"Drupal\Core\StringTranslation\TranslatableMarkup":3:{s:9:"*string";s:37:"Adds layout settings for Exposed form";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:2:"id";s:10:"vefl_basic";s:5:"class";s:47:"Drupal\vefl\Plugin\views\exposed_form\VeflBasic";s:8:"provider";s:4:"vefl";}s:14:"input_required";a:9:{s:6:"parent";s:6:"parent";s:11:"plugin_type";s:12:"exposed_form";s:14:"register_theme";b:1;s:5:"title";O:48:"Drupal\Core\StringTranslation\TranslatableMarkup":3:{s:9:"*string";s:14:"Input required";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:11:"short_title";s:0:"";s:4:"help";O:48:"Drupal\Core\StringTranslation\TranslatableMarkup":3:{s:9:"*string";s:73:"An exposed form that only renders a view if the form contains user input.";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:2:"id";s:14:"input_required";s:5:"class";s:52:"Drupal\views\Plugin\views\exposed_form\InputRequired";s:8:"provider";s:5:"views";}s:5:"basic";a:9:{s:6:"parent";s:6:"parent";s:11:"plugin_type";s:12:"exposed_form";s:14:"register_theme";b:1;s:5:"title";O:48:"Drupal\Core\StringTranslation\TranslatableMarkup":3:{s:9:"*string";s:5:"Basic";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:11:"short_title";s:0:"";s:4:"help";O:48:"Drupal\Core\StringTranslation\TranslatableMarkup":3:{s:9:"*string";s:18:"Basic exposed form";s:12:"*arguments";a:0:{}s:10:"*options";a:0:{}}s:2:"id";s:5:"basic";s:5:"class";s:44:"Drupal\views\Plugin\views\exposed_form\Basic";s:8:"provider";s:5:"views";}} [:db_insert_placeholder_6] => 1 ) i Drupal\Core\Cache\DatabaseBackend->doSetMultiple() (linje 273 af /var/www/clients/client2/web15/web/web/core/lib/Drupal/Core/Cache/DatabaseBackend.php).

  • ๐Ÿ‡ท๐Ÿ‡ดRomania gge

    Hello,

    Applied the patch manually against version 2.1.1 and got this:
    Got error 'PHP message: PHP Fatal error: Nesting level too deep - recursive dependency? in /var/www/public_html/web/modules/contrib/calendar_view/calendar_view.module on line 137'

    Line 137 is:
    array_multisort($array, SORT_ASC, $list);

    The server is running php 8.1.18 (memory limit 2304M) and drupal 9.5.3.

    Thanks~

  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark robotjox

    thanks @gge - commenting out that line makes everything work.
    Events still seem to be sorted correctly.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia omkar_yewale Mumbai

    I fixed it by using usort.

      if (count($list) > 1) {
        $array = array_map(function ($row) {
          return $row['#values']['first_instance'] ?? NULL;
        }, $list);
        array_multisort($array, SORT_ASC, $list);
      }
    

    To

      if (count($list) > 1) {
        usort($list, function ($row1, $row2) {
          $firstInstance1 = $row1['#values']['first_instance'] ?? NULL;
          $firstInstance2 = $row2['#values']['first_instance'] ?? NULL;
          return $firstInstance1 <=> $firstInstance2;
        });
      }
    
  • ๐Ÿ‡ท๐Ÿ‡ดRomania gge

    @robotjox you're welcome but not sure if the right solution is to comment out that line. As @matthieuscarset mentioned here ๐Ÿ› Calendar doesn't show results when using pagination "Calender by month" Fixed , "Sort order is always ASC inside calendar days (e.g. in order to keep multiday events always at the top)"

  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark robotjox

    @gge totally agree, but with out the patch a lot of events are not shown and with the patch site crashes, so until there is a proper solution, this hack works for us (we dont use many multiday events).

  • ๐Ÿ‡ท๐Ÿ‡ดRomania gge

    @omkar_yewale your fix does the trick, thanks~

  • Status changed to Fixed over 1 year ago
  • Thank you very much for your reviews and for the fix.

    The issue is fixed on the dev branch (see referenced commit above).

    Tested with multiple days and multiple fields overlapping on the same calendar day.

    Feel free to reopen if you find a new situation.

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed over 1 year ago
  • ๐Ÿ‡จ๐Ÿ‡ดColombia angelgarciaco Bogotรก, Colombia

    Thanks dude.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium svendecabooter Gent

    @matthieuscarset:
    Any chance of tagging a new release soon, that includes this fix?

Production build 0.71.5 2024