File size: 778 Bytes
360b354
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from typing import List, Dict

def get_platform_order_counts(data) -> List[Dict[str, int]]:
    platform_data = data.get("getPlatFormOrderTotal", [])
    return [
        {
            "name": item["_id"], "order_count": item["count"]
        } for item in platform_data
    ]


def get_platform_revenue(data) -> List[Dict[str, float]]:
    platform_data = data.get("getPlatFormOrderTotal", [])
    return [
        {
            "name": item["_id"], "revenue": item["sales"]
        } for item in platform_data
    ]


def get_total_order_count(data) -> Dict[str, int]:
    total_order_data = data.get("count", 0)
    return total_order_data


def get_total_revenue_count(data) -> Dict[str, float]:
    total_revenue_data = data.get("sales", 0.0)
    return total_revenue_data