Bläddra i källkod

thx to tealeg 2

Dasflugen 5 år sedan
förälder
incheckning
a73c3772c2
1 ändrade filer med 22 tillägg och 19 borttagningar
  1. 22 19
      schedule/xlsx.go

+ 22 - 19
schedule/xlsx.go

@@ -28,26 +28,11 @@ func ImportXLSX(filename string) []*PlanXLSX {
         plan.GroupNumber   = strings.Split(splited[len(splited)-1], "-")[0]
         plan.GroupNumber   = strings.Split(splited[len(splited)-1], "-")[0]
 
 
         sheet.ForEachRow(func(row *Row) error {
         sheet.ForEachRow(func(row *Row) error {
-            if i < 20 {
-                continue
-            }
-            if len(row.Cells) < 20 {
-                continue
-            }
-            if row.Cells[2].String() == "" || row.Cells[2].String() == "ИТОГО" {
-                continue
-            }
-
-            if strings.HasPrefix(row.Cells[1].String(), "Консультации") || strings.HasPrefix(row.Cells[1].String(), "Государственная") {
-                continue
-            }
-
             splited := strings.Split(row.Cells[1].String(), ".")
             splited := strings.Split(row.Cells[1].String(), ".")
-            if len(splited) != 2 {
-                continue
-            }
-
-            typerow := TypeRow(IsSubTR)
+            if i >= 20 && len(row.Cells) >= 20 && len(row.Cells)>=20 && !(row.Cells[2].String() == "" || row.Cells[2].String() == "ИТОГО")
+            && !(strings.HasPrefix(row.Cells[1].String(), "Консультации") || strings.HasPrefix(row.Cells[1].String(), "Государственная"))
+            && len(splited) == 2{
+                typerow := TypeRow(IsSubTR)
             switch {
             switch {
             case strings.Contains(row.Cells[2].String(), "цикл"):
             case strings.Contains(row.Cells[2].String(), "цикл"):
                 typerow = IsCycleTR
                 typerow = IsCycleTR
@@ -113,6 +98,24 @@ func ImportXLSX(filename string) []*PlanXLSX {
                 },
                 },
                 TypeRow: typerow,
                 TypeRow: typerow,
             })
             })
+            }
+            // if len(row.Cells) < 20 {
+            //     continue
+            // }
+            // if row.Cells[2].String() == "" || row.Cells[2].String() == "ИТОГО" {
+            //     continue
+            // }
+
+            // if strings.HasPrefix(row.Cells[1].String(), "Консультации") || strings.HasPrefix(row.Cells[1].String(), "Государственная") {
+            //     continue
+            // }
+
+            // splited := strings.Split(row.Cells[1].String(), ".")
+            // if len(splited) != 2 {
+            //     continue
+            // }
+
+            
         }
         }
         listOfPlans = append(listOfPlans, plan)
         listOfPlans = append(listOfPlans, plan)