[LON-CAPA-cvs] cvs: loncom /metadata_database searchcat.pl
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 03 Feb 2003 13:42:16 -0000
albertel Mon Feb 3 08:42:16 2003 EDT
Modified files:
/loncom/metadata_database searchcat.pl
Log:
- modifying header to be correct
- cleaning out unneccesary comments
Index: loncom/metadata_database/searchcat.pl
diff -u loncom/metadata_database/searchcat.pl:1.28 loncom/metadata_database/searchcat.pl:1.29
--- loncom/metadata_database/searchcat.pl:1.28 Mon Feb 3 00:39:37 2003
+++ loncom/metadata_database/searchcat.pl Mon Feb 3 08:42:16 2003
@@ -2,30 +2,29 @@
# The LearningOnline Network
# searchcat.pl "Search Catalog" batch script
#
-# $Id: searchcat.pl,v 1.28 2003/02/03 05:39:37 harris41 Exp $
+# $Id: searchcat.pl,v 1.29 2003/02/03 13:42:16 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
-# This file is part of the LearningOnline Network with a
-# Computer assisted personalized approach (loncapa).
+# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
#
-# Loncapa is free software; you can redistribute it and/or modify
+# LON-CAPA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
-# Loncapa is distributed in the hope that it will be useful,
+# LON-CAPA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with loncapa; if not, write to the Free Software
+# along with LON-CAPA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# /home/httpd/html/adm/gpl.txt
#
-# http://www.loncapa.org/
+# http://www.lon-capa.org/
#
# YEAR=2001
# 04/14/2001, 04/16/2001 Scott Harrison
@@ -376,14 +375,12 @@
B<build_on_the_fly_dynamic_metadata> - evaluate and store dynamic metadata.
Dynamic metadata is stored in a nohist_resevaldata GDBM database.
-Most of the calculations in this subroutine are totally pointless
-and not useful for anything that this subroutine does.
-(THIS IS A FRUSTRATED SUBROUTINE THAT IS NON-OPTIMAL, *&*&!.)
The only thing that this subroutine really makes happen is adjusting
a 'count' value inside the F<nohist_new_resevaldata.db> as well
as updating F<nohist_new_resevaldata.db> with information from
F<nohist_resevaldata.db>.
+It may need optmization, but since it gets called once a week. . .
=over 4
Parameters:
@@ -404,9 +401,9 @@
sub build_on_the_fly_dynamic_metadata ($)
{
- # BEWARE ALL WHO TRY TO UNDERSTAND THIS ABSURDLY HORRIBLE SUBROUTINE.
-
- # Do all sorts of mumbo-jumbo to compute the user's directory.
+ # some elements in here maybe non-obvious
+
+ # Need to compute the user's directory.
my $url = &declutter(shift(@_));
$url =~ s/\.meta$//;
my %returnhash = ();
@@ -444,12 +441,11 @@
# Untaint the url and use as part of a regular expression.
my $regexp = $url;
$regexp =~ s/(\W)/\\$1/g;
- $regexp = '___'.$regexp.'___([a-z]+)$';
+ $regexp = '___'.$regexp.'___([a-z]+)$'; #' emacs
# Check existing nohist database for this url.
- # THE ONLY TIME THIS IS IMPORTANT FOR THIS AWFUL SUBROUTINE
- # IS FOR 'count' ENTRIES
- # AND FOR REFRESHING non-'count' ENTRIES INSIDE nohist_new DATABASE.
+ # this is modfying the 'count' entries
+ # and copying all othe entries over
foreach (keys %evaldata)
{
my $key = &unescape($_);
@@ -494,15 +490,14 @@
}
if ($ctype ne 'count')
{
- # ALERT! THIS HORRIBLE LOOP IS ACTUALLY DOING SOMETHING
- # USEFUL!
+ # this is copying all data except 'count' attributes
$newevaldata{$_} = $evaldata{$_};
}
}
}
- # THE ONLY OTHER TIME THIS LOOP IS USEFUL IS FOR THE 'count' HASH
- # ELEMENT.
+ # the only other time this loop is useful is for the 'count' hash
+ # element
foreach (keys %cnt)
{
if ($listitems{$_} eq 'avg')
@@ -519,8 +514,7 @@
}
}
- # A RARE MOMENT OF DOING ANYTHING USEFUL INSIDE THIS
- # BLEEPING SUBROUTINE.
+ # seems to be doing something useful
if ($returnhash{'count'})
{
my $newkey = $$.'_'.time.'_searchcat___'.&escape($url).'___count';
@@ -531,9 +525,6 @@
untie(%newevaldata); # Close/release the new nohist database.
}
return(%returnhash);
- # Celebrate! We have now accomplished some simple calculations using
- # 1000% bloated functionality in our subroutine. Go wash your eyeballs
- # out now.
}
=pod