A simplified version of the logic used in the function before my fix is as follow: ```ruby result = [] things = [0,1,2,3] max_values = 2 every = (things.size.to_f / max_values).ceil things.each_with_index do |t, index| next unless (t % every) === 0 result << t end p result # [0, 2] # 3 doesn’t get included ``` The problem is that if you get unlucky two times you won't get last tuple(s) and might get a very erroneous date. Double unlucky: - last tuple index % computed every !== 0 and you don't get the last tuple - the last tuple is related to a post with a very different date than the previous tuples (on year difference in our case) |
||
|---|---|---|
| .. | ||
| backup_restore | ||
| compression | ||
| content_security_policy | ||
| i18n | ||
| imap/providers | ||
| seed_data | ||
| site_settings | ||
| validators | ||
| webauthn | ||
| bookmark_manager_spec.rb | ||
| bookmark_query_spec.rb | ||
| bookmark_reminder_notification_handler_spec.rb | ||
| browser_detection_spec.rb | ||
| content_security_policy_spec.rb | ||
| db_helper_spec.rb | ||
| discourse_js_processor_spec.rb | ||
| encodings_spec.rb | ||
| introduction_updater_spec.rb | ||
| mini_sql_multisite_connection_spec.rb | ||
| search_spec.rb | ||
| shrink_uploaded_image_spec.rb | ||
| theme_flag_modifier_spec.rb | ||
| theme_javascript_compiler_spec.rb | ||
| timeline_lookup_spec.rb | ||
| topic_upload_security_manager_spec.rb | ||
| upload_creator_spec.rb | ||
| upload_recovery_spec.rb | ||
| upload_security_spec.rb | ||