Active
Project:
Views Calc
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Apr 2012 at 19:39 UTC
Updated:
20 Sep 2013 at 09:43 UTC
Hi, I have a view with just the default display and a page display that is exactly the same as the default. I've noticed that the sum is wrong when I don't explicitly set the filters (I have a date filter that defaults to "First of This Month" to "Last of This Month".
When I go to the view, it shows only this months results but until I explicitly apply the filters, it shows the sum of all the records so my guess is that it's ignoring the filter's default values.
Here's the export of the view:
$view = new view;
$view->name = 'time_tracker_reports';
$view->description = 'A view for reporting on time tracker data.';
$view->tag = '';
$view->base_table = 'time_tracker_entry';
$view->core = 0;
$view->api_version = '2';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(
'uid' => array(
'label' => 'User',
'required' => 0,
'id' => 'uid',
'table' => 'time_tracker_entry',
'field' => 'uid',
'relationship' => 'none',
),
'cid' => array(
'label' => 'Comment',
'required' => 0,
'id' => 'cid',
'table' => 'time_tracker_entry',
'field' => 'cid',
'relationship' => 'none',
),
'nid' => array(
'label' => 'Node',
'required' => 0,
'id' => 'nid',
'table' => 'time_tracker_entry',
'field' => 'nid',
'relationship' => 'none',
),
'activity' => array(
'label' => 'Activity',
'required' => 0,
'id' => 'activity',
'table' => 'time_tracker_entry',
'field' => 'activity',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'pid' => array(
'label' => 'project',
'required' => 0,
'id' => 'pid',
'table' => 'casetracker_case',
'field' => 'pid',
'relationship' => 'nid',
),
));
$handler->override_option('fields', array(
'name' => array(
'label' => 'Name',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_user' => 1,
'overwrite_anonymous' => 0,
'anonymous_text' => '',
'exclude' => 0,
'id' => 'name',
'table' => 'users',
'field' => 'name',
'relationship' => 'uid',
'override' => array(
'button' => 'Override',
),
),
'title_1' => array(
'label' => 'Project',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title_1',
'table' => 'node',
'field' => 'title',
'relationship' => 'nid',
),
'title' => array(
'label' => 'Title',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'nid',
),
'timestamp' => array(
'label' => 'Timestamp',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'date_format' => 'custom',
'custom_date_format' => 'M jS, Y',
'reldate' => '0',
'exclude' => 0,
'id' => 'timestamp',
'table' => 'time_tracker_entry',
'field' => 'timestamp',
'relationship' => 'none',
),
'duration' => array(
'label' => 'Duration',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'absolute' => 0,
'link_class' => '',
'alt' => '',
'rel' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'hide_alter_empty' => 1,
'set_precision' => FALSE,
'precision' => 0,
'decimal' => '.',
'separator' => ',',
'format_plural' => 0,
'format_plural_singular' => '1',
'format_plural_plural' => '@count',
'prefix' => '',
'suffix' => ' hours',
'exclude' => 0,
'id' => 'duration',
'table' => 'time_tracker_entry',
'field' => 'duration',
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'timestamp' => array(
'id' => 'timestamp',
'table' => 'time_tracker_entry',
'field' => 'timestamp',
),
));
$handler->override_option('filters', array(
'uid' => array(
'operator' => 'in',
'value' => '',
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'uid_op',
'identifier' => 'uid',
'label' => 'Name',
'optional' => 1,
'remember' => 0,
'reduce' => 0,
),
'id' => 'uid',
'table' => 'users',
'field' => 'uid',
'relationship' => 'uid',
),
'timestamp' => array(
'operator' => 'between',
'value' => array(
'type' => 'relative',
'value' => '',
'min' => 'First Of This Month',
'max' => 'Last Of This Month',
),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'timestamp_op',
'identifier' => 'timestamp',
'label' => 'Entered Between',
'optional' => 1,
'remember' => 0,
),
'id' => 'timestamp',
'table' => 'time_tracker_entry',
'field' => 'timestamp',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
'field_ts_task_project_nid' => array(
'operator' => 'or',
'value' => array(),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'field_ts_task_project_nid_op',
'identifier' => 'field_ts_task_project_nid',
'label' => 'Project',
'bef_format' => 'default',
'optional' => 1,
'single' => 1,
'remember' => 0,
'reduce' => 0,
),
'id' => 'field_ts_task_project_nid',
'table' => 'node_data_field_ts_task_project',
'field' => 'field_ts_task_project_nid',
'relationship' => 'nid',
'reduce_duplicates' => 0,
),
));
$handler->override_option('access', array(
'type' => 'role',
'role' => array(
4 => 4,
),
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('items_per_page', 0);
$handler->override_option('style_plugin', 'views_calc');
$handler->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 0,
'order' => 'asc',
'summary' => '',
'columns' => array(
'name' => 'name',
'title_1' => 'title_1',
'title' => 'title',
'timestamp' => 'timestamp',
'duration' => 'duration',
),
'info' => array(
'name' => array(
'sortable' => 0,
'separator' => '',
'justification' => 'views_calc_justify_none',
'has_calc' => 0,
'calc' => array(),
),
'title_1' => array(
'sortable' => 0,
'separator' => '',
'justification' => 'views_calc_justify_none',
'has_calc' => 0,
'calc' => array(),
),
'title' => array(
'sortable' => 0,
'separator' => '',
'justification' => 'views_calc_justify_none',
'has_calc' => 0,
'calc' => array(),
),
'timestamp' => array(
'separator' => '',
'justification' => 'views_calc_justify_none',
'has_calc' => 0,
'calc' => array(),
),
'duration' => array(
'separator' => '',
'justification' => 'views_calc_justify_none',
'has_calc' => 1,
'calc' => array(
'SUM' => 'SUM',
),
),
),
'default' => '-1',
'detailed_values' => '0',
));
$handler = $view->new_display('page', 'Page', 'page_2');
$handler->override_option('relationships', array(
'uid' => array(
'label' => 'User',
'required' => 0,
'id' => 'uid',
'table' => 'time_tracker_entry',
'field' => 'uid',
'relationship' => 'none',
),
'cid' => array(
'label' => 'Comment',
'required' => 0,
'id' => 'cid',
'table' => 'time_tracker_entry',
'field' => 'cid',
'relationship' => 'none',
),
'nid' => array(
'label' => 'Node',
'required' => 0,
'id' => 'nid',
'table' => 'time_tracker_entry',
'field' => 'nid',
'relationship' => 'none',
),
'activity' => array(
'label' => 'Activity',
'required' => 0,
'id' => 'activity',
'table' => 'time_tracker_entry',
'field' => 'activity',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('fields', array(
'name' => array(
'label' => 'Name',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_user' => 1,
'overwrite_anonymous' => 0,
'anonymous_text' => '',
'exclude' => 0,
'id' => 'name',
'table' => 'users',
'field' => 'name',
'relationship' => 'uid',
'override' => array(
'button' => 'Override',
),
),
'title' => array(
'label' => 'Title',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'nid',
),
'timestamp' => array(
'label' => 'Timestamp',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'date_format' => 'custom',
'custom_date_format' => 'M jS, Y',
'reldate' => '0',
'exclude' => 0,
'id' => 'timestamp',
'table' => 'time_tracker_entry',
'field' => 'timestamp',
'relationship' => 'none',
),
'duration' => array(
'label' => 'Duration',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'absolute' => 0,
'link_class' => '',
'alt' => '',
'rel' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'hide_alter_empty' => 1,
'set_precision' => FALSE,
'precision' => 0,
'decimal' => '.',
'separator' => ',',
'format_plural' => 0,
'format_plural_singular' => '1',
'format_plural_plural' => '@count',
'prefix' => '',
'suffix' => '',
'exclude' => 0,
'id' => 'duration',
'table' => 'time_tracker_entry',
'field' => 'duration',
'relationship' => 'none',
'override' => array(
'button' => 'Use default',
),
),
));
$handler->override_option('path', 'admin/reports/time_tracker/main_report');
$handler->override_option('menu', array(
'type' => 'normal',
'title' => 'Time Tracker',
'description' => '',
'weight' => '0',
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
note that this might be related to #1017594 and #510754 or #1021228 but I believe this is a separate issue.
Thanks!
Comments
Comment #1
lucascaro commentedjust changing the title to something more significant.
Comment #2
razkovnik commentedDid you find some solution for this problem? I'm experiencing the same here.
Regards!
Comment #3
FOxy75 commentedConfirm. It seems that the date filter is taken from the "master" view instead than from the active display. I had a "master view" with a "date = current year" filter. The views_calc display was showing all the records according to the display filter values, but only the records having date = "current year" were considered for the computation. I had to remove the date filter from the master to have the display work correctly.