@@ -10,9 +10,10 @@ import (
10
10
"io"
11
11
"mime/multipart"
12
12
"net/http"
13
- "net/url"
14
13
"os"
15
14
"path/filepath"
15
+
16
+ "github.com/gocarina/gocsv"
16
17
)
17
18
18
19
type DataSetPlugin struct {
@@ -82,8 +83,6 @@ func (srv *BrightspaceService) IntoCourse(bsCourse BrightspaceCourse) *models.Co
82
83
imgPath = ""
83
84
}
84
85
}
85
-
86
- externalUrl , err := url .JoinPath (srv .BaseURL , "" )
87
86
course := models.Course {
88
87
ProviderPlatformID : srv .ProviderPlatformID ,
89
88
ExternalID : bsCourse .OrgUnitId ,
@@ -93,7 +92,7 @@ func (srv *BrightspaceService) IntoCourse(bsCourse BrightspaceCourse) *models.Co
93
92
TotalProgressMilestones : uint (0 ), //come back to this one
94
93
Description : "Brightspace Course: " + bsCourse .Name ,
95
94
ThumbnailURL : imgPath ,
96
- ExternalURL : externalUrl ,
95
+ ExternalURL : srv . BaseURL , //update this when the time comes
97
96
}
98
97
99
98
fmt .Println ("image path: " , imgPath )
@@ -222,3 +221,14 @@ func (srv *BrightspaceService) downloadAndUnzipFile(targetDirectory string, targ
222
221
}
223
222
return destPath , err
224
223
}
224
+
225
+ func readCSV [T any ](values * T , csvFilePath string ) {
226
+ coursesFile , err := os .OpenFile (csvFilePath , os .O_RDWR | os .O_CREATE , os .ModePerm )
227
+ if err != nil {
228
+ panic (err )
229
+ }
230
+ defer coursesFile .Close ()
231
+ if err := gocsv .UnmarshalFile (coursesFile , values ); err != nil { // Load clients from file
232
+ panic (err )
233
+ }
234
+ }
0 commit comments