added fields to mumbai holiday, added a do() func in fix_missing_atlas_data

This commit is contained in:
Johnson Chetty 2012-10-05 12:20:06 +02:00
parent 3ff07f1acc
commit 9032e1e483
6 changed files with 18 additions and 6 deletions

View File

@ -84639,10 +84639,10 @@ trip_id,arrival_time,departure_time,stop_id,stop_sequence
5261_4703_FW_DOWN,26:57:50,26:58:00,2640,18
5261_4703_FW_DOWN,26:59:29,26:59:39,1837,19
5261_4703_FW_DOWN,,,2714,20
5261_4703_FW_DOWN,03:04:27,03:04:37,353,21
5261_4703_FW_DOWN,27:04:27,27:04:37,353,21
5261_4703_FW_DOWN,,,352,22
5261_4703_FW_DOWN,,,351,23
5261_4703_FW_DOWN,03:09:00,03:09:10,350,24
5261_4703_FW_DOWN,27:09:00,27:09:10,350,24
3881_4695_HOL_UP,07:02:00,07:02:00,318,1
3881_4695_HOL_UP,,,331,2
3881_4695_HOL_UP,,,1175,3

View File

@ -172,15 +172,15 @@ def fix_missing_headways():
# try to use the previous column....if available
#if getattr(schedule, column): continue
if col_idx > 0:
prev_headway = getattr(schedule, columns[col_idx-1])
prev_headway = getattr(schedule, hcolumns[col_idx-1])
if prev_headway:
setattr(schedule, column, prev_headway)
schedule.save()
continue
# ... or the next column, if it comes to that.
if col_idx < len(columns)-1:
next_headway = getattr(schedule, columns[col_idx+1])
if col_idx < len(hcolumns)-1:
next_headway = getattr(schedule, hcolumns[col_idx+1])
if next_headway:
setattr(schedule, column, next_headway)
schedule.save()

View File

@ -214,6 +214,11 @@ def importUniqueRoutes():
stopErrorsFile.write(json.dumps(stopErrors, indent=2))
stopErrorsFile.close()
def do():
csvToJSON()
processJSON()
importUniqueRoutes()
'''
>>>formatTime("06.40")
>>>time(6,40)

View File

@ -194,7 +194,7 @@ class DepotAdmin(admin.ModelAdmin):
class HolidayAdmin(admin.ModelAdmin):
list_display = ("date", "name")
list_display = ("date", "name","day","operating_schedule")
readonly_fields = ("date", "name")
search_fields = ("name", "date")
formfield_overrides = {

View File

@ -414,6 +414,8 @@ class Depot(models.Model):
class Holiday(models.Model):
date = models.DateField()
name = models.TextField(max_length=100)
day = models.TextField(max_length=20)
operating_schedule=models.TextField(max_length=20)
def __unicode__(self):
return self.name

View File

@ -0,0 +1,5 @@
ALTER TABLE "mumbai_holiday"
ADD "operating_schedule" text;
ALTER TABLE "mumbai_holiday"
ADD "day" text;
COMMIT;