Skip to content

Commit

Permalink
Add truncate to checksum_calculated_at
Browse files Browse the repository at this point in the history
  • Loading branch information
ericaporter committed Apr 22, 2024
1 parent 83da45f commit d66cd0d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/dfe/analytics/services/generic_checksum_calculator.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require_relative '../shared/service_pattern'
require_relative '../shared/checksum_query_components'

module DfE
module Analytics
Expand Down Expand Up @@ -63,7 +62,7 @@ def build_select_and_order_clause(order_column, table_name_sanitized)
def build_where_clause(order_column, table_name_sanitized, checksum_calculated_at_sanitized)
return '' unless WHERE_CLAUSE_ORDER_COLUMNS.map(&:downcase).include?(order_column.downcase)

"WHERE DATE_TRUNC('milliseconds', #{table_name_sanitized}.#{order_column.downcase}) < #{checksum_calculated_at_sanitized}"
"WHERE #{table_name_sanitized}.#{order_column.downcase} < #{checksum_calculated_at_sanitized}"
end
end
end
Expand Down
3 changes: 1 addition & 2 deletions lib/dfe/analytics/services/postgres_checksum_calculator.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require_relative '../shared/service_pattern'
require_relative '../shared/checksum_query_components'

module DfE
module Analytics
Expand Down Expand Up @@ -66,7 +65,7 @@ def build_select_and_order_clause(order_column, table_name_sanitized)
def build_where_clause(order_column, table_name_sanitized, checksum_calculated_at_sanitized)
return '' unless WHERE_CLAUSE_ORDER_COLUMNS.map(&:downcase).include?(order_column.downcase)

"WHERE #{table_name_sanitized}.#{order_column.downcase} < #{checksum_calculated_at_sanitized}"
"WHERE DATE_TRUNC('milliseconds', #{table_name_sanitized}.#{order_column.downcase}) < DATE_TRUNC('milliseconds', '#{checksum_calculated_at_sanitized}')"
end
end
end
Expand Down

0 comments on commit d66cd0d

Please sign in to comment.