|
@@ -17,22 +17,35 @@ func ImportXLSX(filename string) []*PlanXLSX {
|
|
|
}
|
|
|
for _, sheet := range xlFile.Sheets {
|
|
|
var plan = new(PlanXLSX)
|
|
|
- x, _ := sheet.Cell(5, 1)
|
|
|
- plan.ProgramCode = x.String()
|
|
|
- namecode, _ := sheet.Cell(5,6)
|
|
|
- plan.NameCode = strings.Split(namecode.String(), " ")[0]
|
|
|
- pof, _ := sheet.Cell(7,6)
|
|
|
- plan.PeriodOfStudy = pof.String()
|
|
|
- spl, _ := sheet.Cell(9,1)
|
|
|
- splited := strings.Split(spl.String(), " ")
|
|
|
+ plan.ProgramCode = sheet.Rows[5].Cells[1].String()
|
|
|
+ plan.NameCode = strings.Split(sheet.Rows[5].Cells[6].String(), " ")[0]
|
|
|
+ plan.PeriodOfStudy = sheet.Rows[7].Cells[6].String()
|
|
|
+ splited := strings.Split(sheet.Rows[9].Cells[1].String(), " ")
|
|
|
plan.GroupNumber = strings.Split(splited[len(splited)-1], "-")[0]
|
|
|
|
|
|
- sheet.ForEachRow(func(row *Row) error {
|
|
|
- splited := strings.Split(row.GetCell(1).Value.String(), ".")
|
|
|
- if len(row.Cells) >= 20 && len(row.Cells)>=20 && !(row.GetCell(2).Value.String() == "" || row.GetCell(2).Value.String() == "ИТОГО") && !(strings.HasPrefix(row.GetCell(1).Value.String(), "Консультации") || strings.HasPrefix(row.GetCell(1).Value.String(), "Государственная")) && len(splited) == 2{
|
|
|
- typerow := TypeRow(IsSubTR)
|
|
|
+ for i, row := range sheet.Rows {
|
|
|
+ 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(), ".")
|
|
|
+ if len(splited) != 2 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+
|
|
|
+ typerow := TypeRow(IsSubTR)
|
|
|
switch {
|
|
|
- case strings.Contains(row.GetCell(2).Value.String(), "цикл"):
|
|
|
+ case strings.Contains(row.Cells[2].String(), "цикл"):
|
|
|
typerow = IsCycleTR
|
|
|
case splited[1] == "00":
|
|
|
typerow = IsStartTR
|
|
@@ -40,23 +53,23 @@ func ImportXLSX(filename string) []*PlanXLSX {
|
|
|
typerow = IsPmTR
|
|
|
}
|
|
|
|
|
|
- max, _ := row.GetCell(4).Value.Int()
|
|
|
- selfstudy, _ := row.GetCell(5).Value.Int()
|
|
|
- allstudy, _ := row.GetCell(6).Value.Int()
|
|
|
- lectures, _ := row.GetCell(7).Value.Int()
|
|
|
- labs, _ := row.GetCell(8).Value.Int()
|
|
|
- projects, _ := row.GetCell(9).Value.Int()
|
|
|
- c1s1, _ := row.GetCell(12).Value.Int()
|
|
|
- c1s2, _ := row.GetCell(13).Value.Int()
|
|
|
- c2s1, _ := row.GetCell(14).Value.Int()
|
|
|
- c2s2, _ := row.GetCell(15).Value.Int()
|
|
|
- c3s1, _ := row.GetCell(16).Value.Int()
|
|
|
- c3s2, _ := row.GetCell(17).Value.Int()
|
|
|
- c4s1, _ := row.GetCell(18).Value.Int()
|
|
|
- c4s2, _ := row.GetCell(19).Value.Int()
|
|
|
+ max, _ := row.Cells[4].Int()
|
|
|
+ selfstudy, _ := row.Cells[5].Int()
|
|
|
+ allstudy, _ := row.Cells[6].Int()
|
|
|
+ lectures, _ := row.Cells[7].Int()
|
|
|
+ labs, _ := row.Cells[8].Int()
|
|
|
+ projects, _ := row.Cells[9].Int()
|
|
|
+ c1s1, _ := row.Cells[12].Int()
|
|
|
+ c1s2, _ := row.Cells[13].Int()
|
|
|
+ c2s1, _ := row.Cells[14].Int()
|
|
|
+ c2s2, _ := row.Cells[15].Int()
|
|
|
+ c3s1, _ := row.Cells[16].Int()
|
|
|
+ c3s2, _ := row.Cells[17].Int()
|
|
|
+ c4s1, _ := row.Cells[18].Int()
|
|
|
+ c4s2, _ := row.Cells[19].Int()
|
|
|
|
|
|
certform := ""
|
|
|
- splited = strings.Split(row.GetCell(3).Value.String(), ",")
|
|
|
+ splited = strings.Split(row.Cells[3].String(), ",")
|
|
|
for _, v := range splited {
|
|
|
if v != "-" {
|
|
|
certform = v
|
|
@@ -65,8 +78,8 @@ func ImportXLSX(filename string) []*PlanXLSX {
|
|
|
}
|
|
|
|
|
|
plan.Lines = append(plan.Lines, LineXLSX{
|
|
|
- ID: row.GetCell(1).Value.String(),
|
|
|
- Name: row.GetCell(2).Value.String(),
|
|
|
+ ID: row.Cells[1].String(),
|
|
|
+ Name: row.Cells[2].String(),
|
|
|
CertForm: certform,
|
|
|
StudyLoad: StudyLoadXLSX{
|
|
|
Max: max,
|
|
@@ -96,8 +109,7 @@ func ImportXLSX(filename string) []*PlanXLSX {
|
|
|
},
|
|
|
TypeRow: typerow,
|
|
|
})
|
|
|
- }
|
|
|
- })
|
|
|
+ }
|
|
|
listOfPlans = append(listOfPlans, plan)
|
|
|
}
|
|
|
return listOfPlans
|