global Extractions für region capacities monthly and weekdays eingefügt, closes #15
This commit is contained in:
		
							parent
							
								
									0733709366
								
							
						
					
					
						commit
						7e3862a578
					
				@ -497,6 +497,21 @@ class Database:
 | 
			
		||||
				extractions.created_at < '{scrape_date_max}'	
 | 
			
		||||
			""")
 | 
			
		||||
 | 
			
		||||
	def singleScrape_of_global_scrapDate(self, scrape_date_min: str, scrape_date_max: str):
 | 
			
		||||
		return self.connection.sql(f"""
 | 
			
		||||
			SELECT 
 | 
			
		||||
				JSON_EXTRACT(body, '$.content.days') as calendarBody, 
 | 
			
		||||
				extractions.created_at 
 | 
			
		||||
			FROM 
 | 
			
		||||
				consultancy_d.extractions 
 | 
			
		||||
			LEFT JOIN 
 | 
			
		||||
				consultancy_d.properties ON properties.id = extractions.property_id 
 | 
			
		||||
			WHERE
 | 
			
		||||
				type == 'calendar' AND
 | 
			
		||||
				extractions.created_at >= '{scrape_date_min}' AND
 | 
			
		||||
				extractions.created_at < '{scrape_date_max}'	
 | 
			
		||||
			""")
 | 
			
		||||
 | 
			
		||||
	def capacity_global(self):
 | 
			
		||||
		return self.connection.sql(f"""
 | 
			
		||||
			SELECT 
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,12 @@ def region_capacities_monthly(id: int, scrapeDate_start: str):
 | 
			
		||||
    # Get end date of start search-window
 | 
			
		||||
    scrapeDate_end = scrapeDate_start + timedelta(days=1)
 | 
			
		||||
 | 
			
		||||
    extractions = d.singleScrape_of_region_scrapDate(id, scrapeDate_start, scrapeDate_end).pl()
 | 
			
		||||
    # Get Data
 | 
			
		||||
    if id == -1:
 | 
			
		||||
        extractions = d.singleScrape_of_global_scrapDate(scrapeDate_start, scrapeDate_end).pl()
 | 
			
		||||
    else:
 | 
			
		||||
        extractions = d.singleScrape_of_region_scrapDate(id, scrapeDate_start, scrapeDate_end).pl()
 | 
			
		||||
 | 
			
		||||
    df_calendar = pl.DataFrame()
 | 
			
		||||
    numWeeks = 0
 | 
			
		||||
    firstExe = True
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,12 @@ def region_capacities_weekdays(id: int, scrapeDate_start: str):
 | 
			
		||||
    # Get end date of start search-window
 | 
			
		||||
    scrapeDate_end = scrapeDate_start + timedelta(days=1)
 | 
			
		||||
 | 
			
		||||
    extractions = d.singleScrape_of_region_scrapDate(id, scrapeDate_start, scrapeDate_end).pl()
 | 
			
		||||
    # Get Data
 | 
			
		||||
    if id == -1:
 | 
			
		||||
        extractions = d.singleScrape_of_global_scrapDate(scrapeDate_start, scrapeDate_end).pl()
 | 
			
		||||
    else:
 | 
			
		||||
        extractions = d.singleScrape_of_region_scrapDate(id, scrapeDate_start, scrapeDate_end).pl()
 | 
			
		||||
 | 
			
		||||
    df_calendar = pl.DataFrame()
 | 
			
		||||
    numWeeks = 0
 | 
			
		||||
    firstExe = True
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user