SparkDevNetwork / Rock

An open source CMS, Relationship Management System (RMS) and Church Management System (ChMS) all rolled into one.
http://www.rockrms.com
563 stars 345 forks source link

Calculate Metrics Job is not updating values #5905

Open azturner opened 3 weeks ago

azturner commented 3 weeks ago

Description

When a metric is configured with multiple partitions and using SQL as it's data source (with a query that returns the MetricValueDateTime), the metric values will not get updated when the Calculate Metrics job runs and there happens to already be an existing value for the metric with the same date and partition values that are not returned by the query,

Actual Behavior

In the scenario above, the update is actually getting a silent exception when it tries to add new metric values (see this issue: https://github.com/SparkDevNetwork/Rock/issues/5904), so the job will not add any new values or update any existing values for the metric on the specified date.

Expected Behavior

When query returns values for a metric for specific date and partition combination, any existing values with that same date and partition values should be updated with new values. If existing entries do not exist with same date and partition values, a new metric value should be added. This is the behavior specified in the help text of the Metric source:

NOTE: If a [MetricValueDateTime] is specified and there is already a metric value, the value will get updated. This is handy if you have a weekly metric, but schedule it to calculate every day.

Steps to Reproduce

Issue Confirmation

Rock Version

v15.4, v16.2

Client Culture Setting

en-US