Merge pull request #6697 from opf/fix/enforce_order_on_journal_aggregation

enforce order when numbering for journal aggregation
pull/6689/head
Markus Kahl 6 years ago committed by GitHub
commit fe21fd7992
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      app/models/journal/aggregated_journal.rb

@ -178,7 +178,8 @@ class Journal::AggregatedJournal
"SELECT predecessor.*, #{sql_group_counter(uid)} AS group_number
FROM #{sql_rough_group_from_clause(uid)}
#{sql_rough_group_join(conditions[:join_conditions])}
#{sql_rough_group_where(conditions[:where_conditions])}"
#{sql_rough_group_where(conditions[:where_conditions])}
#{sql_rough_group_order}"
end
def additional_conditions(journable, until_version, journal_id)
@ -224,6 +225,10 @@ class Journal::AggregatedJournal
#{additional_conditions}"
end
def sql_rough_group_order
"ORDER BY predecessor.created_at"
end
# The "group_number" required in :sql_rough_group has to be generated differently depending on
# the DBMS used. This method returns the appropriate statement to be used inside a SELECT to
# obtain the current group number.

Loading…
Cancel
Save