Moved file truncation closer to loop to make it easier to comment out

This commit is contained in:
Brian Warren 2017-12-18 13:42:16 -06:00
parent af4ae1be8a
commit eb86a97805
2 changed files with 4 additions and 5 deletions

View File

@ -19,6 +19,7 @@ class EspnPickemStripStats(StripStats):
# Class variables
season_start_month = 8 #needed to handle case when season starts and finishes in different years and the
#current year must be inferred
time_zone = 'US/Eastern'
# Override abstract method and return data extracted from "html_doc" object
def strip_data(self, url):
@ -91,7 +92,7 @@ class EspnPickemStripStats(StripStats):
time = '0' + time #pad with zero if necessary
date_string = month + ' ' + day + ' ' + str(year) + ' ' + time
datetime_obj_utc = StripStats.date_object_utc_from_string(date_string, 'US/Eastern')
datetime_obj_utc = StripStats.date_object_utc_from_string(date_string, EspnPickemStripStats.time_zone)
row['datetime'] = datetime_obj_utc.strftime('%Y-%m-%d %H:%M:%S %z')
# Media network
@ -145,8 +146,6 @@ FIELDS = (
'confidence',
)
open(OUTPUT_FILE, 'w').close() #truncate file
# 2015-2016
#START_YEAR = 2015
#ENTRY_IDS = [276612, 171981]
@ -159,6 +158,7 @@ ENTRY_IDS = [171981]
START_YEAR = 2017
ENTRY_IDS = [537245]
open(OUTPUT_FILE, 'w').close() #truncate file
for i, entry_id in enumerate(ENTRY_IDS):
this_year = i + START_YEAR
start_period = (this_year - YEAR_ZERO) * WEEKS_PER_SEASON + 1

View File

@ -140,8 +140,6 @@ FIELDS = [
:confidence,
]
File.open(OUTPUT_FILE, 'w') {} #truncate file
# 2015 and 2016
#START_YEAR = 2015
#ENTRY_IDS = [276612, 171981]
@ -154,6 +152,7 @@ File.open(OUTPUT_FILE, 'w') {} #truncate file
START_YEAR = 2017
ENTRY_IDS = [537245]
File.open(OUTPUT_FILE, 'w') {} #truncate file
ENTRY_IDS.each_with_index do |entry_id, i|
year = i + START_YEAR
start_period = (year - YEAR_ZERO) * WEEKS_PER_SEASON + 1