Changeset f7c613 in indico


Ignore:
Timestamp:
02/14/11 16:42:05 (2 years ago)
Author:
Jose Benito <jose.benito.gonzalez@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 0da0c1403bae8e51d8229f460181c71b9e6dda72
Children:
38b4e2
Parents:
9576e61
git-author:
Leszek Syroka <leszek.marek.syroka@…> (08/10/10 11:41:22)
git-committer:
Jose Benito <jose.benito.gonzalez@…> (02/14/11 16:42:05)
Message:

[FIX] Abstract list optimization

  • data about abstracts, tracks, fields, authors etc. are fetched only when specific information is to be displayed
  • filters are not checked when all filtering possibilities are selected
  • displayed fields options are saved in the session variable
  • list creation optimized
  • reviewed by jbenito: bug in displaying info, using methods instead of protected vars.
  • fixes #508
Location:
indico/MaKaC/webinterface
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/webinterface/common/abstractFilters.py

    r8b64ae rf7c613  
    8686        if self.onlyMultiple() and len(abstract.getTrackList())<2: 
    8787            return False 
    88         #ToDo: to be optimised by using OOSet intersections or indexes 
    89         hasTracks = False 
    90         for track in abstract.getTrackList(): 
    91             hasTracks = True 
    92             if track.getId() in self._values: 
    93                 return True 
    94         if not hasTracks: 
    95             return self._showNoValue 
    96         return False 
     88        if len(self._conf.getTrackList()) == len(self._values): 
     89            return True 
     90        else: 
     91            #ToDo: to be optimised by using OOSet intersections or indexes 
     92            hasTracks = False 
     93            for track in abstract.getTrackList(): 
     94                hasTracks = True 
     95                if track.getId() in self._values: 
     96                    return True 
     97            if not hasTracks: 
     98                return self._showNoValue 
     99            return False 
    97100 
    98101    def needsToBeApplied(self): 
     
    123126 
    124127    def satisfies( self, abstract ): 
    125         if not abstract.getContribType(): 
     128        if len(self._conf.getContribTypeList()) == len(self._values): 
     129            return True 
     130        elif not abstract.getContribType(): 
    126131            return self._showNoValue 
    127         return abstract.getContribType() in self._values 
     132        else: 
     133            return abstract.getContribType() in self._values 
    128134 
    129135    def needsToBeApplied(self): 
     
    140146 
    141147    def satisfies(self,abstract): 
    142         s=abstract.getCurrentStatus() 
    143         if s.__class__ in [review.AbstractStatusAccepted,\ 
    144                             review.AbstractStatusProposedToAccept]: 
    145             if s.getType() is None or s.getType()=="": 
     148        if len(self._conf.getContribTypeList()) == len(self._values): 
     149            return True 
     150        else: 
     151            s=abstract.getCurrentStatus() 
     152            if s.__class__ in [review.AbstractStatusAccepted,\ 
     153                                review.AbstractStatusProposedToAccept]: 
     154                if s.getType() is None or s.getType()=="": 
     155                    return self._showNoValue 
     156                return s.getType() in self._values 
     157            else: 
    146158                return self._showNoValue 
    147             return s.getType() in self._values 
    148         else: 
    149             return self._showNoValue 
    150159 
    151160    def needsToBeApplied(self): 
     
    169178            if s.getTrack() is None: 
    170179                return self._showNoValue 
    171             return s.getTrack().getId() in self._values 
     180            elif len(self._conf.getTrackList()) == len(self._values): 
     181                return True 
     182            else: 
     183                return s.getTrack().getId() in self._values 
    172184        else: 
    173185            return self._showNoValue 
  • indico/MaKaC/webinterface/pages/conferences.py

    rf9e2b0 rf7c613  
    59815981                url.addParam("order","down") 
    59825982        vars["dateSortingURL"] = quoteattr( str( url ) ) 
    5983  
    5984  
    5985  
    5986  
    59875983        l = [] 
    59885984        f = filters.SimpleFilter( self._filterCrit, self._sortingCrit ) 
    59895985        abstractList=f.apply(self._conf.getAbstractMgr().getAbstractsMatchingAuth(self._authSearch)) 
    59905986        for abstract in abstractList: 
    5991             tracks = [] 
    5992             for track in abstract.getTrackListSorted(): 
    5993                 tracks.append("%s"%self.htmlText(track.getCode() or track.getId())) 
    5994  
    59955987            s=abstract.getCurrentStatus() 
    5996             status=AbstractStatusList.getInstance().getCode(s.__class__ ) 
    5997             statusIconURL=AbstractStatusList.getInstance().getIconURL(s.__class__) 
    5998             statusIconHTML = """<img src=%s border="0" alt="">"""%quoteattr(str(statusIconURL)) 
    5999             contribType = abstract.getContribType() 
    6000             contribTypeName = _("None") 
    6001             if contribType: 
    6002                 contribTypeName = contribType.getName() 
    6003             subDate = abstract.getSubmissionDate().strftime("%d %B %Y") 
    60045988            comments = "" 
    60055989            if abstract.getComments(): 
    60065990                comments = _(""" <img src=%s alt="_("The submitter filled some comments")">""")%(quoteattr(Config.getInstance().getSystemIconURL("comments"))) 
    60075991            accTrack,accType="&nbsp;","&nbsp;" 
    6008             if isinstance(s,review.AbstractStatusAccepted): 
    6009                 if s.getTrack() is not None: 
    6010                     accTrack=self.htmlText(s.getTrack().getCode()) 
    6011                 if s.getType() is not None: 
    6012                     accType=self.htmlText(s.getType().getName()) 
    6013             elif isinstance(s,review.AbstractStatusProposedToAccept): 
    6014                 if s.getTrack() is not None: 
    6015                     accTrack=self.htmlText(s.getTrack().getCode()) 
    6016                 if s.getType() is not None: 
    6017                     accType=self.htmlText(s.getType().getName()) 
    60185992            urlGen=urlHandlers.UHCFAAbstractManagment.getURL 
    6019             authList = [] 
    6020             for auth in abstract.getPrimaryAuthorList(): 
    6021                 if auth.getFullName(): 
    6022                     authList.append(auth.getFullName()) 
    6023             PAuthors = "<br>".join(authList) 
    6024  
    60255993            m = ["""<td valign="top" align="right" width="3%%"><input onchange="javascript:isSelected('abstracts%s')" type="checkbox" name="abstracts" value="%s"></td>"""%(abstract.getId(), abstract.getId())] 
    60265994            if self._fields["ID"][1] == "checked": 
     
    60305998                        <a href=%s>%s</a></td>"""%(quoteattr(str(urlGen(abstract))), self.htmlText(abstract.getTitle()))) 
    60315999            if self._fields["PrimaryAuthor"][1] == "checked": 
     6000                authList = [ auth.getFullName() for auth in abstract.getPrimaryAuthorList() if auth.getFullName()] 
     6001                PAuthors = "<br>".join(authList) 
    60326002                m.append("""<td class="CRLabstractDataCell">%s</td>"""%PAuthors) 
    60336003            if self._fields["Tracks"][1] == "checked": 
     6004                tracks = [ self.htmlText(track.getCode() or track.getId()) for track in abstract.getTrackListSorted()] 
    60346005                m.append("""<td class="CRLabstractDataCell">%s</td>"""%("<br>".join(tracks) or "&nbsp;")) 
    60356006            if self._fields["Type"][1] == "checked": 
     6007                contribType = abstract.getContribType() 
     6008                contribTypeName = _("None") 
     6009                if contribType: 
     6010                    contribTypeName = contribType.getName() 
    60366011                m.append("""<td class="CRLabstractDataCell">%s</td>"""%self.htmlText(contribTypeName)) 
    60376012            if self._fields["Status"][1] == "checked": 
     6013                status=AbstractStatusList.getInstance().getCode(s.__class__ ) 
     6014                statusIconURL=AbstractStatusList.getInstance().getIconURL(s.__class__) 
     6015                statusIconHTML = """<img src=%s border="0" alt="">"""%quoteattr(str(statusIconURL)) 
    60386016                m.append("""<td class="CRLabstractDataCell" nowrap>%s %s</td>"""%(statusIconHTML,status)) 
    60396017            if self._fields["AccTrack"][1] == "checked": 
     6018                if isinstance(s,review.AbstractStatusAccepted): 
     6019                    if s.getTrack() is not None: 
     6020                        accTrack=self.htmlText(s.getTrack().getCode()) 
     6021                elif isinstance(s,review.AbstractStatusProposedToAccept): 
     6022                    if s.getTrack() is not None: 
     6023                        accTrack=self.htmlText(s.getTrack().getCode()) 
    60406024                m.append("""<td class="CRLabstractDataCell">%s</td>"""%accTrack) 
    60416025            if self._fields["AccType"][1] == "checked": 
     6026                if isinstance(s,review.AbstractStatusAccepted): 
     6027                    if s.getType() is not None: 
     6028                        accType=self.htmlText(s.getType().getName()) 
     6029                elif isinstance(s,review.AbstractStatusProposedToAccept): 
     6030                    if s.getType() is not None: 
     6031                        accType=self.htmlText(s.getType().getName()) 
    60426032                m.append("""<td class="CRLabstractDataCell">%s</td>"""%accType) 
    60436033            if self._fields["SubmissionDate"][1] == "checked": 
    6044                 m.append("""<td class="CRLabstractDataCell" nowrap>%s</td>"""%subDate) 
     6034                m.append("""<td class="CRLabstractDataCell" nowrap>%s</td>"""%abstract.getSubmissionDate().strftime("%d %B %Y")) 
    60456035            if len(m) == 1: 
    60466036                m = ["<td></td>"] 
  • indico/MaKaC/webinterface/rh/conferenceModif.py

    r64b616 rf7c613  
    39493949 
    39503950    def satisfies( self, abstract ): 
    3951         status = AbstractStatusList.getInstance().getId( abstract.getCurrentStatus().__class__ ) 
    3952         return status in self._values 
     3951        if len(AbstractStatusList.getInstance().getStatusList()) == len(self._values): 
     3952            return True 
     3953        else: 
     3954            status = AbstractStatusList.getInstance().getId( abstract.getCurrentStatus().__class__ ) 
     3955            return status in self._values 
    39533956 
    39543957    def needsToBeApplied(self): 
     
    41114114            del sessionData['comment'] 
    41124115 
    4113  
    41144116        # TODO: improve this part and do it as with the registrants 
    4115         self._fields["ID"] = [ _("ID"), sessionData.get("showID", "")] 
    4116         self._fields["PrimaryAuthor"] = [ _("Primary Author"), sessionData.get("showPrimaryAuthor", "")] 
    4117         self._fields["Tracks"] = [ _("Tracks"), sessionData.get("showTracks", "")] 
    4118         self._fields["Type"] = [ _("Type"), sessionData.get("showType", "")] 
    4119         self._fields["Status"] = [ _("Status"), sessionData.get("showStatus", "")] 
    4120         self._fields["AccTrack"] = [ _("showAcc. Track"), sessionData.get("showAccTrack", "")] 
    4121         self._fields["AccType"] = [ _("showAcc. Type"), sessionData.get("showAccType", "")] 
    4122         self._fields["SubmissionDate"] = [ _("Submission Date"), sessionData.get("showSubmissionDate", "")] 
     4117        sessionData["fields"] = {"ID": [ _("ID"), params.get("showID","")], 
     4118                                "PrimaryAuthor": [ _("Primary Author"), params.get("showPrimaryAuthor","")], 
     4119                                "Tracks": [ _("Tracks"), params.get("showTracks","")], 
     4120                                "Type": [ _("Type"), params.get("showType","")], 
     4121                                "Status": [ _("Status"), params.get("showStatus","")], 
     4122                                "AccTrack": [ _("Acc. Track"), params.get("showAccTrack","")], 
     4123                                "AccType": [ _("Acc. Type"), params.get("showAccType","")], 
     4124                                "SubmissionDate": [ _("Submission Date"), params.get("showSubmissionDate","")]} 
    41234125 
    41244126        return sessionData 
     
    41744176        RHConfModifCFABase._checkParams( self, params ) 
    41754177 
    4176         self._fields = {} 
    4177  
    41784178        operationType = params.get('operationType') 
    41794179 
     
    42164216        self._msg = sessionData.get("directAbstractMsg","") 
    42174217        self._authSearch = sessionData.get("authSearch", "") 
     4218        self._fields = sessionData.get("fields",{}) 
    42184219 
    42194220    def _process( self ): 
Note: See TracChangeset for help on using the changeset viewer.