Download & Extend

Views support: when sorting by role weights a node appears three times.

Project:Role Weights
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Something is broken in the role wights table. when sorting by role weights a node appears three times. This ususally indicates the $table returns something erronous. Resulting in a strange JOIN query built by views module.

Comments

#1

Can you provide your view? I can't reproduce this here.

#2

http://incubator.beauty-coach.nl/vacatures/alle

  $view = new stdClass();
  $view->name = 'Vacatures';
  $view->description = 'Vacatures';
  $view->access = array (
);
  $view->page = TRUE;
  $view->page_title = 'Vacatures';
  $view->page_header = '';
  $view->page_header_format = '1';
  $view->page_type = 'teaser';
  $view->url = 'vacatures/alle';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '10';
  $view->block = TRUE;
  $view->block_title = '';
  $view->block_header = '';
  $view->block_header_format = '1';
  $view->block_type = 'teaser';
  $view->nodes_per_block = '0';
  $view->block_more = '0';
  $view->block_use_page_header = FALSE;
  $view->sort = array (
    array (
      'tablename' => 'node',
      'field' => 'sticky',
      'sortorder' => 'ASC',
      'options' => '',
    ),
    array (
      'tablename' => 'role_weights',
      'field' => 'weight',
      'sortorder' => 'ASC',
      'options' => '',
    ),
    array (
      'tablename' => 'node',
      'field' => 'created',
      'sortorder' => 'DESC',
      'options' => '',
    ),
  );
  $view->argument = array (
    array (
      'type' => 'taxletter',
      'argdefault' => '2',
      'title' => 'Vacatures: %1',
      'options' => '',
    ),
  );
  $view->field = array (
    array (
      'tablename' => 'node',
      'field' => 'title',
      'label' => '',
      'handler' => 'views_handler_field_nodelink',
    ),
    array (
      'tablename' => 'term_node_9',
      'field' => 'name',
      'label' => '',
    ),
    array (
      'tablename' => 'term_node_8',
      'field' => 'name',
      'label' => '',
    ),
    array (
      'tablename' => 'term_node_14',
      'field' => 'name',
      'label' => '',
    ),
    array (
      'tablename' => 'term_node_7',
      'field' => 'name',
      'label' => '',
    ),
  );
  $view->filter = array (
    array (
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array (
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
  0 => 'content-vacature',
),
    ),
    array (
      'tablename' => 'node',
      'field' => 'moderate',
      'operator' => '=',
      'options' => '',
      'value' => '0',
    ),
    array (
      'tablename' => 'term_node_9',
      'field' => 'tid',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
),
    ),
    array (
      'tablename' => 'term_node_11',
      'field' => 'tid',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
),
    ),
    array (
      'tablename' => 'term_node_7',
      'field' => 'tid',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
),
    ),
    array (
      'tablename' => 'term_node_8',
      'field' => 'tid',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
),
    ),
    array (
      'tablename' => 'term_node_14',
      'field' => 'tid',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
),
    ),
  );
  $view->requires = array(node, role_weights, term_node_9, term_node_8, term_node_14, term_node_7, term_node_11);
  $views[$view->name] = $view;

#3

Any luck with this and more recent versions of Views, Bèr?

#4

Title:views table bug: when sorting by role weights a node appears three times.» Views support: when sorting by role weights a node appears three times.
Status:active» postponed (maintainer needs more info)

#5

Check your join type or add a group by. My view was outputting a node for each row in the role weights table.

#6

Version:master» 5.x-1.x-dev

#7

Status:postponed (maintainer needs more info)» active

Yep, this problem occurs when a user has more than one role, present in 5.x & 6.x/HEAD.

#8

Hi, any solution for this? I need to use more roles for the user, but I need it to appear in a Views listing just once.. thanx

#9

Anyone? thank You