Skip to content
  • 20after4's avatar
    New PropertyMatcher class and example usage in boardmetrics.py · 95a4349a
    20after4 authored
    More or less complete usage example:
    
    ```py
            def process_transactions(transactions):
                mapper = PropertyMatcher()
    
                @mapper("transactionType=core:edge", "meta.edge:type=41")
                def edge(t):
                    ''' match project edge transactions '''
                    oldValue = [PHIDRef(p) for p in t["oldValue"]]
                    newValue = [PHIDRef(p) for p in t["newValue"]]
                    return [["projects", '', oldValue, newValue]]
    
                for taskid, t in transactions.result.items():
                    st = sorted(t, key=itemgetter("dateCreated"))
                    for record in st:
                        for row in mapper.run(record):
                            if row:
                                yield row
    
            transactions = get_some_transactions()
    
            for row in process_transactions(transactions):
                ''' do something with row '''
    ```
    
    Change-Id: I6eac22574b02df75b9fd8c38d1a29856dd05f130
    95a4349a