diff --git a/contact-scrape-test/contact-scrape.go b/contact-scrape-test/contact-scrape.go index 2da9315..9369186 100644 --- a/contact-scrape-test/contact-scrape.go +++ b/contact-scrape-test/contact-scrape.go @@ -187,7 +187,6 @@ func parseExcelFile(filename string) ([]Contact, error) { func parseTable(f *excelize.File, sheetName, startCol, endCol string, tableNum int) []Contact { var contacts []Contact var currentContact *Contact - var lastUpdate string // Get all rows in the sheet rows, err := f.GetRows(sheetName) @@ -220,8 +219,6 @@ func parseTable(f *excelize.File, sheetName, startCol, endCol string, tableNum i // Check for "Aktualizace" - end of data if len(row) > nameCol && strings.Contains(strings.ToLower(row[nameCol]), "aktualizace") { - lastUpdate = row[nameCol] - currentContact = nil // Reset to avoid attaching to previous contact break } @@ -259,43 +256,19 @@ func parseTable(f *excelize.File, sheetName, startCol, endCol string, tableNum i Table: tableNum, } contacts = append(contacts, *currentContact) - } else if strings.Contains(name, "Aktualizace") { - // Capture the update date - lastUpdate = name - currentContact = nil // Reset to avoid attaching to previous contact - } else if currentContact != nil && name == "" { - // This is additional data for the current contact or a general contact - if position != "" && !strings.Contains(position, "Vorlová") && !strings.Contains(position, "inženýrka") { - // Treat as a general contact if it doesn't contain specific personal identifiers - currentContact = &Contact{ - Name: position, // Use position as the name for general contacts - Position: "", - Phone: phone, - ServicePhone: servicePhone, - Table: tableNum, - } - contacts = append(contacts, *currentContact) - } else if position != "" { - newContact := *currentContact + } else if currentContact != nil { + // This is additional data for the current contact + newContact := *currentContact + if position != "" { newContact.Position = position - if phone != "" { - newContact.Phone = phone - } - if servicePhone != "" { - newContact.ServicePhone = servicePhone - } - contacts = append(contacts, newContact) } - } - } - - // Update last updated date - if lastUpdate != "" { - lastUpdated, err := time.Parse("2.1.2006", lastUpdate) - if err != nil { - log.Printf("Error parsing last updated date: %v", err) - } else { - currentData.LastUpdated = lastUpdated + if phone != "" { + newContact.Phone = phone + } + if servicePhone != "" { + newContact.ServicePhone = servicePhone + } + contacts = append(contacts, newContact) } } diff --git a/contact-scrape-test/contacts.xlsx b/contact-scrape-test/contacts.xlsx index b1ef6f5..07b950b 100644 Binary files a/contact-scrape-test/contacts.xlsx and b/contact-scrape-test/contacts.xlsx differ diff --git a/contact-scrape-test/index.html b/contact-scrape-test/index.html index 9bd11c8..a1969a8 100644 --- a/contact-scrape-test/index.html +++ b/contact-scrape-test/index.html @@ -1,374 +1,371 @@ - - - - - - Kontakty - - - - -
-
- -
-
-

📞 Kontakty

-

Firemní telefonní seznam

-
- -
- - -
-
- - - - -
-
- - -
- - - -
- - -
-
-

Načítání kontaktů...

-
- - - - - - -
-
- - - + + + + + + Kontakty + + + + + +
+
+

Poppe + Potthoff - Kontakty

+

Firemní telefonní seznam

+
+
+ +
+ +
+
+ +
+ +
+
+
+ + +
+ + + +
+ + +
+
+

Načítání kontaktů...

+
+ + + + + + +
+ + + + + \ No newline at end of file