Ticket #3913 (new defect)

Opened 3 years ago

Last modified 3 years ago

Counts wrong in browse views

Reported by: af05v@… Owned by:
Priority: unset Milestone: EPrints 3.2.10
Component: - Version:
Severity: normal Keywords:
Cc:

Description

Discovered when trying to replicate a different problem:

To replicate:

Install 3.2.4 Create archive import test data run the following script

#!/usr/bin/perl -I/opt/eprints3/perl_lib

use strict;
use warnings;
use EPrints;

my $session = EPrints::Session->new(1, 'eprints_test');
my $ds = $session->get_repository->get_dataset('eprint');

$ds->map($session, \&insert_creators_ids);

sub insert_creators_ids
{
        my ($session, $ds, $eprint) = @_;

        my $creators = $eprint->get_value('creators');
        my $editors;
        foreach my $creator (@{$creators})
        {
                $creator->{id} = int(rand(30))+1;
                my $editor;
                $editor->{name} = $creator->{name};
                $editor->{id} = int(rand(30))+1;
                push @{$editors}, $editor;
        }
        $eprint->set_value('creators', $creators);
        $eprint->set_value('editors', $editors);

        $eprint->commit;
}

Modify the 'fields' part of the default 'divisions' browse view to:

        {
                id => "divisions",
                menus => [
                        {
                                fields => [ "creators_id", "editors_id" ],
                        },
                        {
...

Then regenerate the view.

When I did it, the counts for some of the items in the first menu were lower than the counts in some of the items in the lower menu. For example,

 http://adam.eprints.org/view/divisions/

Please select a value to browse from the list below.

    * 1 (18)
    * 10 (17)
    * 11 (18)
    * 12 (20)
    * 13 (15)
    * 14 (13)
    * 15 (14)
    * 16 (15)
    * 17 (16)
    * 18 (18)
    * 19 (22)
    * 2 (21)
    * 20 (20)
    * 21 (20)
    * 22 (17)
    * 23 (21)
    * 24 (9)
    * 25 (13)
    * 26 (23)
    * 27 (9)
    * 28 (13)
    * 29 (10)
    * 3 (16)
    * 30 (22)
    * 4 (9)
    * 5 (12)
    * 6 (13)
    * 7 (13)
    * 8 (19)
    * 9 (15)

Clicking on 13:  http://adam.eprints.org/view/divisions/13/

Please select a value to browse from the list below.

    * 2005 (8)
    * 2004 (16)
    * 2003 (7)
    * 2002 (13)
    * 2001 (10)
    * 2000 (17)
    * 1999 (13)
    * 1998 (16)

And then, clicking on 1998:  http://adam.eprints.org/view/divisions/13/1998.html

Jump to: S
Number of items: 1.
S

Syvitski, C. (1998) Migration routes of the Hyacinth Macaw. In: 12th Conference on Animal Things, 4-9 February, Jura, Scotland.

Only one item that was counted as 16 -- more than was at the top level. I suspect the first count and the last count may be more accurate than the middle count.

Change History

Changed 3 years ago by af05v@…

OOps, silly html formatting. That should read:

To replicate:

Install 3.2.4, Create archive, import test data, and run the following script

Note: See TracTickets for help on using tickets.