File tree Expand file tree Collapse file tree 4 files changed +44
-0
lines changed
Expand file tree Collapse file tree 4 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 77DB = firestore .Client (project = os .environ .get ('PROJECT' ), database = os .environ .get ('DATABASE' ))
88TABLE = 'adoption'
99
10+ def get_latest_date ():
11+ """Retrieve the latest date in the collection."""
12+ query = DB .collection (TABLE ).order_by ('date' , direction = firestore .Query .DESCENDING ).limit (1 )
13+ docs = query .stream ()
14+ for doc in docs :
15+ return doc .to_dict ().get ('date' )
16+ return None
17+
1018def list_data (params ):
1119
1220 technology_array = convert_to_array (params ['technology' ])
1321 data = []
1422
23+ if 'end' in params and params ['end' ] == 'latest' :
24+ params ['start' ] = get_latest_date ()
25+
1526 for technology in technology_array :
1627 query = DB .collection (TABLE )
1728
Original file line number Diff line number Diff line change 77DB = firestore .Client (project = os .environ .get ('PROJECT' ), database = os .environ .get ('DATABASE' ))
88TABLE = 'core_web_vitals'
99
10+ def get_latest_date ():
11+ """Retrieve the latest date in the collection."""
12+ query = DB .collection (TABLE ).order_by ('date' , direction = firestore .Query .DESCENDING ).limit (1 )
13+ docs = query .stream ()
14+ for doc in docs :
15+ return doc .to_dict ().get ('date' )
16+ return None
17+
1018def list_data (params ):
1119 technology_array = convert_to_array (params ['technology' ])
1220 data = []
1321
22+ if 'end' in params and params ['end' ] == 'latest' :
23+ params ['start' ] = get_latest_date ()
24+
1425 for technology in technology_array :
1526 query = DB .collection (TABLE )
1627
Original file line number Diff line number Diff line change 77DB = firestore .Client (project = os .environ .get ('PROJECT' ), database = os .environ .get ('DATABASE' ))
88TABLE = 'lighthouse'
99
10+ def get_latest_date ():
11+ """Retrieve the latest date in the collection."""
12+ query = DB .collection (TABLE ).order_by ('date' , direction = firestore .Query .DESCENDING ).limit (1 )
13+ docs = query .stream ()
14+ for doc in docs :
15+ return doc .to_dict ().get ('date' )
16+ return None
17+
1018def list_data (params ):
1119
1220 technology_array = convert_to_array (params ['technology' ])
1321 data = []
1422
23+ if 'end' in params and params ['end' ] == 'latest' :
24+ params ['start' ] = get_latest_date ()
25+
1526 for technology in technology_array :
1627 query = DB .collection (TABLE )
1728
Original file line number Diff line number Diff line change 77DB = firestore .Client (project = os .environ .get ('PROJECT' ), database = os .environ .get ('DATABASE' ))
88TABLE = 'page_weight'
99
10+ def get_latest_date ():
11+ """Retrieve the latest date in the collection."""
12+ query = DB .collection (TABLE ).order_by ('date' , direction = firestore .Query .DESCENDING ).limit (1 )
13+ docs = query .stream ()
14+ for doc in docs :
15+ return doc .to_dict ().get ('date' )
16+ return None
17+
1018def list_data (params ):
1119
1220 technology_array = convert_to_array (params ['technology' ])
1321 data = []
1422
23+ if 'end' in params and params ['end' ] == 'latest' :
24+ params ['start' ] = get_latest_date ()
25+
1526 for technology in technology_array :
1627 query = DB .collection (TABLE )
1728
You can’t perform that action at this time.
0 commit comments