Feature Requests: Browse | Submit New | Admin

[#884] Basic statistics on library contents

Date:
2004-09-11 11:50
Priority:
3
Submitted By:
Liam Davison (ljd)
Assigned To:
Nobody (None)
Category:
Interface Improvements (example)
State:
Open
Alexandria Version:
 
Summary:
Basic statistics on library contents

Detailed description
I think a little bit of information about the contents of the current library would be nice. Really basic stuff, along
the lines of:

23 books, 14 unrated, 2 recently added

Likewise, a line that said:

Title "On The Trail of William Wallace (0 946487 47 2)" added

If a title has been successfully added.

Just a little feedback on the status line.

Liam

Add A Comment: Notepad

Please login


Followup

Message
Date: 2004-09-19 20:09
Sender: Laurent Sansonetti

Logged In: YES 
user_id=119

Nice idea Liam.  I just modified Alexandria to print more info
on the status line according to your feedback and code.  As you
can see it is very easy to implement features in Ruby :)

I did not implement the "recently added" info (still
wondering how to do this efficiently), as well as the "title
%s added" info (for this one, I would prefer to automatically
select new books after the addition).

I leave this entry open because the "recently added"
info would be a nice addition.
Date: 2004-09-11 14:38
Sender: Liam Davison

Logged In: YES 
user_id=1147

Even started implementing it myself... And I've never written
a line of ruby before.

In main_app.rb:

def on_books_selection_changed
            books = selected_books
            @appbar.status = case books.length
                when 0
                    _("Library '%s' selected, %d books")
% [selected_library.name, selected_library.length ]
                when 1
                    _("'%s' selected") %
books.first.title
                else
                    n_("%d book selected", "%d
books selected", books.length) \
                        % books.length
            end
            @actiongroup["Properties"].sensitive =
@actiongroup["OnlineInformation"].sensitive = books.length
== 1
            @actiongroup["SelectAll"].sensitive
= books.length < selected_library.length
            @actiongroup["Delete"].sensitive =
@actiongroup["DeselectAll"].sensitive = !books.empty?
        end


And also at the end of on_refresh:

	    # add the current library name to the statusbar
	    @appbar.status = "Library '%s' selected, %d books"
% [ selected_library.name, selected_library.length ]

But I don't know how or if Alexandria keeps track of such things
as rated and unrated books. I don't fancy iterating through the
entire library every time the screen is refreshed, counting the
number of books which don't have a rating...

Attached Files:

Name Description Download
main_app.rb main_app.rb Download

Changes:

Field Old Value Date By
File Added73: main_app.rb2004-09-11 14:38ljd