Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
irees committed Dec 23, 2023
1 parent 9e80ae0 commit e1be5db
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 76 deletions.
6 changes: 0 additions & 6 deletions validator/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,10 @@ func SaveValidationReport(atx tldb.Adapter, result *Result, reportedAt time.Time
TripScheduledCount: s.TripScheduledCount,
TripMatchCount: s.TripMatchCount,
TripScheduledIDs: tt.NewStrings(s.TripScheduledIDs),
// MatchedAt: tt.NewTime(s.MatchedAt),
}
if _, err := atx.Insert(&tripReport); err != nil {
return err
}
// fmt.Printf("tp: %#v\n", tripReport)
}
for _, s := range r.VehiclePositionStats {
vpReport := ValidationReportTripUpdateStat{
Expand All @@ -71,12 +69,10 @@ func SaveValidationReport(atx tldb.Adapter, result *Result, reportedAt time.Time
TripScheduledCount: s.TripScheduledCount,
TripMatchCount: s.TripMatchCount,
TripScheduledIDs: tt.NewStrings(s.TripScheduledIDs),
// MatchedAt: tt.NewTime(s.MatchedAt),
}
if _, err := atx.Insert(&vpReport); err != nil {
return err
}
// fmt.Printf("vp: %#v\n", vpReport)
}
}
}
Expand All @@ -99,7 +95,6 @@ type ValidationReportTripUpdateStat struct {
TripScheduledCount int
TripMatchCount int
TripScheduledIDs tt.Strings `db:"trip_scheduled_ids"`
// MatchedAt tt.Time
tl.DatabaseEntity
}

Expand All @@ -114,7 +109,6 @@ type ValidationReportVehiclePositionStat struct {
TripScheduledCount int
TripMatchCount int
TripScheduledIDs tt.Strings `db:"trip_scheduled_ids"`
// MatchedAt tt.Time
tl.DatabaseEntity
}

Expand Down
70 changes: 0 additions & 70 deletions validator/result_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,76 +54,6 @@ func TestSaveValidationReport(t *testing.T) {
})
}

// func TestContinuousValidation(t *testing.T) {
// dburl := os.Getenv("TL_TEST_DATABASE_URL")
// if dburl == "" {
// t.Skip("TL_TEST_DATABASE_URL is not set")
// return
// }
// writer := testdb.MustOpenWriter(dburl, false)
// atx := writer.Adapter

// rtDir := "/Users/irees/tmp" // testutil.RelPath("test/data/rt")
// reader, err := tlcsv.NewReader(filepath.Join(rtDir, "ct.zip"))
// if err != nil {
// t.Fatal(err)
// }
// ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// buf, err := os.ReadFile(filepath.Join(rtDir, r.URL.Path))
// if err != nil {
// t.Error(err)
// }
// w.Write(buf)
// }))

// // Prepare options
// tz, _ := time.LoadLocation("America/Los_Angeles")
// // now := time.Date(2023, 11, 7, 17, 05, 0, 0, tz)
// opts := Options{
// SaveStaticValidationReport: true,
// SaveRealtimeValidationReport: true,
// }

// // Run
// now := time.Now()
// // Initial validation
// v, _ := NewValidator(reader, opts)
// result, err := v.Validate()
// if err != nil {
// t.Fatal(err)
// }
// if err := SaveValidationReport(atx, result, now, 1, true, true); err != nil {
// t.Fatal(err)
// }

// // Test continuous validation
// fns, err := getFiles("/Users/irees/tmp")
// if err != nil {
// t.Fatal(err)
// }
// for _, fn := range fns {
// subFn := ts.URL + strings.Replace(fn, rtDir, "", 1)
// fmt.Println(subFn)
// rtTest, err := rt.ReadURL(subFn)
// if err != nil {
// t.Fatal(err)
// }
// now = time.Unix(int64(*rtTest.Header.Timestamp), 0).In(tz)
// rtResult, err := v.ValidateRT(subFn, now)
// if err != nil {
// t.Fatal(err)
// }
// // jr, _ := json.Marshal(rtResult)
// // fmt.Println(string(jr))
// result2 := Result{}
// result2.Realtime = append(result2.Realtime, rtResult)
// if err := SaveValidationReport(atx, &result2, now, 1, true, true); err != nil {
// t.Fatal(err)
// }

// }
// }

func getFiles(path string) ([]string, error) {
files := []string{}
if err := filepath.Walk(path,
Expand Down

0 comments on commit e1be5db

Please sign in to comment.