Example #1
0
 def __getDiscountBannerStr(self, root, rootNode):
     htmlStr = ''
     nodeState = rootNode.getState()
     if NODE_STATE.canTradeIn(
             nodeState
     ) and self.__tradeIn.tradeOffSelectedApplicableForLevel(root.level):
         return htmlStr
     if NODE_STATE.isRestoreAvailable(nodeState):
         restoreDueDate = getDueDateOrTimeStr(
             rootNode.getRestoreFinishTime())
         if restoreDueDate:
             return _BANNER_GETTERS[States.RESTORE](restoreDueDate)
     if not root.isUnlocked and not root.isCollectible:
         unlockDiscount = self._itemsCache.items.blueprints.getBlueprintDiscount(
             root.intCD, root.level)
         if unlockDiscount > 0:
             return _BANNER_GETTERS[States.UNLOCKED](unlockDiscount)
     if root.isRented:
         discount = rootNode.getActionDiscount()
         if discount != 0:
             return _BANNER_GETTERS[States.RENT](discount)
     if not NODE_STATE.inInventory(nodeState) and NODE_STATE.isActionVehicle(
             nodeState) or NODE_STATE.isCollectibleActionVehicle(nodeState):
         discount, isPersonalDiscount = rootNode.getActionDetails()
         if discount != 0:
             actionDueDate = '' if isPersonalDiscount else getDueDateOrTimeStr(
                 rootNode.getActionFinishTime(), isShortDateFormat=True)
             return _BANNER_GETTERS[States.ACTION](discount, actionDueDate)
     return htmlStr