Skip to content

duplicate key value violates unique constraint "name_model_grouping_aggregation_period" #39

@kassimhalloyta

Description

@kassimhalloyta

rails 4.2.3
reportable 1.4.2

Get an error for reloading data, looks like cached value is not found by method 'Saulabs::Reportable::ReportCache.build_conditions_for_reading_cached_data'.

Looks like there is a issue when the condition is nil and return quoted Array '[]'.
If i replace quoted Array with empty string from build_conditions_for_reading_cached_data query, it can find the 'cached' data.

 cached_data = read_cached_data(report, options) 
-> []

{:model_class_name=>"Profile", 
:report_name=>"number_of_profiles_falckinos", 
:grouping=>"day", 
:aggregation=>"count", 
:conditions=>"[]"} 
-> []

{:model_class_name=>"Profile", 
:report_name=>"number_of_profiles_falckinos", 
:grouping=>"day", 
:aggregation=>"count", 
:conditions=>""} 
-> #<ActiveRecord::Relation [#<Saulabs::Reportable::ReportCache id: 3138, model_class_name: "Profile", report_name: "number_of_profiles_falckinos", grouping: "day", aggregation: "count", conditions: "", value: 0.0, reporting_period: "2015-08-09 00:00:00", created_at: "2015-08-10 14:19:18", updated_at: "2015-08-10 14:19:18">]>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions