Changeset 1214


Ignore:
Timestamp:
12/12/06 01:31:40 (13 years ago)
Author:
jukka
Message:

Fixed #1036, spent 45min. Now it cuts 100 before the scores are scaled to 1-8 and doesn't do any cutting if they are names or something that can't be scored.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/SectionFolder.py

    r1213 r1214  
    529529            return uniquetuplelist 
    530530        maxcount=max(map(lambda x: x[1], uniquetuplelist)) 
    531         uniquetuplelist=map(adjust, uniquetuplelist)  
    532531        uniquetuplelist.sort() 
     532        if browse_type in ('hits','active_people','active_groups') and len(uniquetuplelist)>100: 
     533            # select value at cut point 
     534            smallest=uniquetuplelist[100][1] 
     535            cutpoint=99 
     536            small_value=uniquetuplelist[cutpoint][1] 
     537            # keep going down the list as long as the values are equal 
     538            while small_value==smallest: 
     539                cutpoint=cutpoint-1 
     540                small_value=uniquetuplelist[cutpoint][1] 
     541            uniquetuplelist=uniquetuplelist[:cutpoint+1] 
     542        uniquetuplelist=map(adjust, uniquetuplelist) 
     543          
    533544        # prettify language names 
    534545        if index_type=='Language' or index_type=='getLanguage_skills': 
     
    606617            except AttributeError: 
    607618                return DEFAULT_ICONS['Piece'] 
    608  
    609     def getLargeTags(self, tags, max_nr): 
    610         if not tags: 
    611             return [] 
    612         count_by_tagsize = [(tagsize, len([x for x in tags if x[1] == tagsize])) for tagsize in (reversed(sorted(set(x[1] for x in tags))))] 
    613         cumsum = [sum([x[1] for x in count_by_tagsize][:i + 1]) for i in range(len(count_by_tagsize))] 
    614         smallest = count_by_tagsize[len([x for x in cumsum if x <= max_nr])-1][0] 
    615  
    616         return [x for x in tags if x[1] >= smallest] 
    617619 
    618620 
  • trunk/skins/lemill/lemill_browse_results.pt

    r1213 r1214  
    9393           <tr> 
    9494             <td>  
    95              <tal:taggy repeat="wordinfo python:here.getLargeTags(wordtuples, 100)"> 
     95             <tal:taggy repeat="wordinfo wordtuples"> 
    9696               <tal:taggyvalues define="sort_name python:wordinfo[0]; 
    9797                       tagsize python:wordinfo[1]; 
Note: See TracChangeset for help on using the changeset viewer.