Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2003:
[Freeciv-Dev] Re: (PR#6074) Numeric sorting in city report
Home

[Freeciv-Dev] Re: (PR#6074) Numeric sorting in city report

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdwheeler42@xxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#6074) Numeric sorting in city report
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 9 Sep 2003 08:39:33 -0700
Reply-to: rt@xxxxxxxxxxxxxx

John Wheeler wrote:
> I think the sorting issues in PR#2607 have been resolved, but I do have
> a very similiar issue: sorting appears to be text based, even for
> numeric fields.

PR#2607 hasn't been addressed at all.

Sorting is done numerically for numeric fields, and alphabetically for 
text fields.  The problem is some fields are combination fields 
(generally containing multiple numbers) that are sorted alphabetically.

>  So, for example after sorting the food stock column,
> you can easily have:
> 
> 124/130
> 47/50
> 5/20
> 64/80
> 
> The simplest solution I can think of is padding short numbers with
> spaces, so the output becomes:
> 
>   5/20
>  47/50
>  64/80
> 124/130
> 
> This also would have the side benefit of improving the appearance.

I think this is a very wrong solution.

1.  Can you guarantee a space (' ') will be alphabetically sorted before 
a digit?

2.  There's no guarantee it will look better.  With a non-fixed-width 
font it is likely to look worse.

3.  Why sort by the first field instead of the second one?

jason




[Prev in Thread] Current Thread [Next in Thread]