Load the directory model from the layered Veracross import
This commit is contained in:
+4
-20
@@ -5,7 +5,6 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"sort"
|
||||
|
||||
"heliosian/internal/data"
|
||||
)
|
||||
@@ -22,28 +21,13 @@ func main() {
|
||||
}
|
||||
source = s
|
||||
}
|
||||
for _, name := range []string{"Basic Directory", "Staff Details", "Classrooms", "Schedules", "Grade Lookup", "Room Parents", "Departments"} {
|
||||
rows, err := source.Table("directory", name)
|
||||
for _, name := range []string{"Veracross Import", "Name to Email", "Overrides", "Change Log"} {
|
||||
header, rows, err := source.Table("directory", name)
|
||||
if err != nil {
|
||||
log.Fatalf("[ERROR] table %s: %v", name, err)
|
||||
}
|
||||
if len(rows) == 0 {
|
||||
fmt.Printf("%s: no rows\n", name)
|
||||
continue
|
||||
}
|
||||
seen := map[string]bool{}
|
||||
columns := []string{}
|
||||
for _, row := range rows {
|
||||
for column := range row {
|
||||
if !seen[column] {
|
||||
seen[column] = true
|
||||
columns = append(columns, column)
|
||||
}
|
||||
}
|
||||
}
|
||||
sort.Strings(columns)
|
||||
fmt.Printf("%s:\n", name)
|
||||
for _, column := range columns {
|
||||
fmt.Printf("%s (%d rows):\n", name, len(rows))
|
||||
for _, column := range header {
|
||||
fmt.Printf(" %s\n", column)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user