示例#1
0
 def grant_finance(self):
     topics = []
     grant_finance = FinanceStatus()
     for topic in self.grant.topic_set.all():
         topic_finance = topic.payment_summary()
         grant_finance.add_finance(topic_finance)
         topics.append({"topic": topic, "finance": topic_finance})
     return {"topics": topics, "finance": grant_finance}
示例#2
0
 def grant_finance(self):
     topics = []
     grant_finance = FinanceStatus()
     for topic in self.grant.topic_set.all():
         topic_finance = topic.payment_summary()
         grant_finance.add_finance(topic_finance)
         topics.append({'topic': topic, 'finance': topic_finance})
     return {'topics': topics, 'finance': grant_finance}
示例#3
0
def topic_finance(request):
    grants_out = []
    for grant in Grant.objects.all():
        topics = []
        grant_finance = FinanceStatus()
        for topic in grant.topic_set.all():
            topic_finance = topic.payment_summary()
            grant_finance.add_finance(topic_finance)
            topics.append({'topic':topic, 'finance':topic_finance})
        grants_out.append({'grant':grant, 'topics':topics, 'finance':grant_finance, 'rows':len(topics)+1})
    
    csums = Cluster.cluster_sums()
    return render(request, 'tracker/topic_finance.html', {
        'grants': grants_out,
        'cluster_sums': csums,
        'total_transactions': csums['paid'] + csums['overpaid'], 
        'have_fuzzy': any([row['finance'].fuzzy for row in grants_out]),
    })