--- loncom/interface/statistics/lonproblemstatistics.pm	2014/02/28 19:20:17	1.126
+++ loncom/interface/statistics/lonproblemstatistics.pm	2018/03/07 12:24:27	1.128
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonproblemstatistics.pm,v 1.126 2014/02/28 19:20:17 bisitz Exp $
+# $Id: lonproblemstatistics.pm,v 1.128 2018/03/07 12:24:27 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -759,9 +759,10 @@ sub BuildProblemStatisticsPage {
                   &Apache::lonstatistics::section_and_enrollment_description().
                   '</p>');
         my $count = 0;
+        my $include_tools = 1;
         foreach my $seq (@sequences) {
             my @resources =
-                &Apache::lonstathelpers::get_resources($navmap,$seq);
+                &Apache::lonstathelpers::get_resources($navmap,$seq,$include_tools);
             $count += scalar(@resources);
         }
         if ($count > 10) {
@@ -1469,8 +1470,9 @@ sub write_headers {
 ##################################################
 sub compute_statistics_on_sequence {
     my ($seq) = @_;
+    my $include_tools = 1;
     my @Data;
-    foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq)) {
+    foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq,$include_tools)) {
         foreach my $part (@{$res->parts}) {
             next if (($res->is_survey($part)) || ($res->is_anonsurvey($part))) ;
             #
@@ -1648,9 +1650,10 @@ Returns: integer between -1 and 1
 ###############################################
 sub compute_discrimination_factor {
     my ($resource,$part,$seq) = @_;
+    my $include_tools = 1;
     my $symb = $resource->symb;
     my @Resources;
-    foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq)){
+    foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq,$include_tools)){
         next if ($res->symb eq $symb);
         push (@Resources,$res->symb);
     }
@@ -1669,11 +1672,11 @@ sub compute_discrimination_factor {
     my $number_to_grab = int(scalar(@{$ranking})/4);
     my $num_students = scalar(@{$ranking});
     my @BottomSet = map { $_->[&Apache::loncoursedata::RNK_student()];
-                      } @{$ranking}[0..$number_to_grab];
+                      } @{$ranking}[0..$number_to_grab-1];
     my @TopSet    =
         map {
             $_->[&Apache::loncoursedata::RNK_student()];
-          } @{$ranking}[-$number_to_grab..0];
+          } @{$ranking}[-$number_to_grab..-1];
     if (! @BottomSet || (@BottomSet == 1 && $BottomSet[0] eq '') ||
         ! @TopSet    || (@TopSet    == 1 && $TopSet[0]    eq '')) {
         return 'nan';
@@ -1714,10 +1717,11 @@ sub compute_discrimination_factor {
 ###############################################
 sub compute_sequence_statistics {
     my ($seq) = @_;
+    my $include_tools = 1;
     my $symb = $seq->symb;
     my @Resources;
     my $part_count;
-    foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq)) {
+    foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq,$include_tools)) {
         push (@Resources,$res->symb);
         $part_count += scalar(@{$res->parts});
     }