From 9032e1e4835f0e7ebce3553f2ff8a58e2a3319e5 Mon Sep 17 00:00:00 2001 From: Johnson Chetty Date: Fri, 5 Oct 2012 12:20:06 +0200 Subject: [PATCH 1/4] added fields to mumbai holiday, added a do() func in fix_missing_atlas_data --- chaloBEST/gtfs/gtfs_mumbai_bus/stop_times.txt | 4 ++-- chaloBEST/imports/fix_missing_atlas_data.py | 6 +++--- chaloBEST/imports/import_atlas.py | 5 +++++ chaloBEST/mumbai/admin.py | 2 +- chaloBEST/mumbai/models.py | 2 ++ sqldiff/sqldiff05102012.sql | 5 +++++ 6 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 sqldiff/sqldiff05102012.sql diff --git a/chaloBEST/gtfs/gtfs_mumbai_bus/stop_times.txt b/chaloBEST/gtfs/gtfs_mumbai_bus/stop_times.txt index b1bf112..71bcdf2 100644 --- a/chaloBEST/gtfs/gtfs_mumbai_bus/stop_times.txt +++ b/chaloBEST/gtfs/gtfs_mumbai_bus/stop_times.txt @@ -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 diff --git a/chaloBEST/imports/fix_missing_atlas_data.py b/chaloBEST/imports/fix_missing_atlas_data.py index f763714..5b10461 100644 --- a/chaloBEST/imports/fix_missing_atlas_data.py +++ b/chaloBEST/imports/fix_missing_atlas_data.py @@ -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() diff --git a/chaloBEST/imports/import_atlas.py b/chaloBEST/imports/import_atlas.py index c2c56df..c2e16e7 100644 --- a/chaloBEST/imports/import_atlas.py +++ b/chaloBEST/imports/import_atlas.py @@ -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) diff --git a/chaloBEST/mumbai/admin.py b/chaloBEST/mumbai/admin.py index a29443d..70aa3e5 100644 --- a/chaloBEST/mumbai/admin.py +++ b/chaloBEST/mumbai/admin.py @@ -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 = { diff --git a/chaloBEST/mumbai/models.py b/chaloBEST/mumbai/models.py index 89e63b6..948e457 100644 --- a/chaloBEST/mumbai/models.py +++ b/chaloBEST/mumbai/models.py @@ -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 diff --git a/sqldiff/sqldiff05102012.sql b/sqldiff/sqldiff05102012.sql new file mode 100644 index 0000000..f111a77 --- /dev/null +++ b/sqldiff/sqldiff05102012.sql @@ -0,0 +1,5 @@ +ALTER TABLE "mumbai_holiday" + ADD "operating_schedule" text; +ALTER TABLE "mumbai_holiday" + ADD "day" text; +COMMIT; \ No newline at end of file From 1a02a9011c2575d74551c078d7dfa7257c73bdde Mon Sep 17 00:00:00 2001 From: Johnson Chetty Date: Fri, 5 Oct 2012 12:24:44 +0200 Subject: [PATCH 2/4] holiday tweaks.. --- chaloBEST/mumbai/admin.py | 1 + 1 file changed, 1 insertion(+) diff --git a/chaloBEST/mumbai/admin.py b/chaloBEST/mumbai/admin.py index 70aa3e5..5a74a7d 100644 --- a/chaloBEST/mumbai/admin.py +++ b/chaloBEST/mumbai/admin.py @@ -195,6 +195,7 @@ class DepotAdmin(admin.ModelAdmin): class HolidayAdmin(admin.ModelAdmin): list_display = ("date", "name","day","operating_schedule") + list_editable = ("day","operating_schedule") readonly_fields = ("date", "name") search_fields = ("name", "date") formfield_overrides = { From 6287dc430cb47c58cea6f7c66bb6066796aef048 Mon Sep 17 00:00:00 2001 From: Johnson Chetty Date: Fri, 5 Oct 2012 12:43:52 +0200 Subject: [PATCH 3/4] holiday tweaks 2 --- chaloBEST/mumbai/admin.py | 4 ++-- chaloBEST/mumbai/models.py | 1 - sqldiff/sqldiff05102012.sql | 2 -- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/chaloBEST/mumbai/admin.py b/chaloBEST/mumbai/admin.py index 5a74a7d..a604e9b 100644 --- a/chaloBEST/mumbai/admin.py +++ b/chaloBEST/mumbai/admin.py @@ -194,8 +194,8 @@ class DepotAdmin(admin.ModelAdmin): class HolidayAdmin(admin.ModelAdmin): - list_display = ("date", "name","day","operating_schedule") - list_editable = ("day","operating_schedule") + list_display = ("date", "name","operating_schedule") + list_editable = ("operating_schedule") readonly_fields = ("date", "name") search_fields = ("name", "date") formfield_overrides = { diff --git a/chaloBEST/mumbai/models.py b/chaloBEST/mumbai/models.py index 948e457..8373e9d 100644 --- a/chaloBEST/mumbai/models.py +++ b/chaloBEST/mumbai/models.py @@ -414,7 +414,6 @@ 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): diff --git a/sqldiff/sqldiff05102012.sql b/sqldiff/sqldiff05102012.sql index f111a77..9b9e19e 100644 --- a/sqldiff/sqldiff05102012.sql +++ b/sqldiff/sqldiff05102012.sql @@ -1,5 +1,3 @@ ALTER TABLE "mumbai_holiday" ADD "operating_schedule" text; -ALTER TABLE "mumbai_holiday" - ADD "day" text; COMMIT; \ No newline at end of file From 3e5723d6f32939caa0d1cb55e1aca0ff817b5c8e Mon Sep 17 00:00:00 2001 From: Johnson Chetty Date: Fri, 5 Oct 2012 12:45:42 +0200 Subject: [PATCH 4/4] holiday tweaks 3 --- chaloBEST/mumbai/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chaloBEST/mumbai/admin.py b/chaloBEST/mumbai/admin.py index a604e9b..a1c6955 100644 --- a/chaloBEST/mumbai/admin.py +++ b/chaloBEST/mumbai/admin.py @@ -195,7 +195,7 @@ class DepotAdmin(admin.ModelAdmin): class HolidayAdmin(admin.ModelAdmin): list_display = ("date", "name","operating_schedule") - list_editable = ("operating_schedule") + list_editable = ("operating_schedule",) readonly_fields = ("date", "name") search_fields = ("name", "date") formfield_overrides = {