mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-08-03 10:19:16 +02:00
fix:#16 fixed database search for module in migration
This commit is contained in:
@@ -30,7 +30,7 @@ func MigrateFeedJson(app *pocketbase.PocketBase) error {
|
|||||||
var uuidFeedCollections []model.FeedCollection
|
var uuidFeedCollections []model.FeedCollection
|
||||||
|
|
||||||
for _, module := range modules {
|
for _, module := range modules {
|
||||||
uuid := searchUUIDForModule(app, module.Name)
|
uuid := searchUUIDForModule(app, module)
|
||||||
|
|
||||||
if uuid != "" {
|
if uuid != "" {
|
||||||
uuidFeedCollections = append(uuidFeedCollections, model.FeedCollection{UUID: uuid, Name: module.Name, Course: module.Course, UserDefinedName: module.UserDefinedName})
|
uuidFeedCollections = append(uuidFeedCollections, model.FeedCollection{UUID: uuid, Name: module.Name, Course: module.Course, UserDefinedName: module.UserDefinedName})
|
||||||
@@ -48,9 +48,9 @@ func MigrateFeedJson(app *pocketbase.PocketBase) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func searchUUIDForModule(app *pocketbase.PocketBase, moduleName string) string {
|
func searchUUIDForModule(app *pocketbase.PocketBase, module model.FeedCollection) string {
|
||||||
var event model.Event
|
var event model.Event
|
||||||
err := app.Dao().DB().Select("*").From("events").Where(dbx.NewExp("Name = {:name}", dbx.Params{"name": moduleName})).One(&event)
|
err := app.Dao().DB().Select("*").From("events").Where(dbx.NewExp("Name = {:name} AND course = {:course}", dbx.Params{"name": module.Name, "course": module.Course})).One(&event)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user