From 23a9716b168cfd7aa42c2694c54aa9b09f6306cf Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Fri, 23 Aug 2024 17:55:29 +0200 Subject: [PATCH] tested different rating tags --- server/backend/cafeteria.go | 6 +++--- server/model/canteen_rating_tag.go | 4 ++-- server/model/dish_name_tag.go | 10 ++++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/server/backend/cafeteria.go b/server/backend/cafeteria.go index 9b998c66..2750b781 100644 --- a/server/backend/cafeteria.go +++ b/server/backend/cafeteria.go @@ -433,9 +433,9 @@ func assignDishNameTag(rating *model.DishRating, dishID int64, tx *gorm.DB) { } else { for _, tagID := range nameTagIDs { if err := tx.Create(&model.DishNameTag{ - CorrespondingRating: rating.DishRating, - Points: rating.Points, - TagNameID: tagID, + RatingID: rating.DishRating, + Points: rating.Points, + TagNameID: tagID, }).Error; err != nil { log.WithError(err).Error("while creating a new dish name rating.") } diff --git a/server/model/canteen_rating_tag.go b/server/model/canteen_rating_tag.go index 688d3f15..30f930cd 100644 --- a/server/model/canteen_rating_tag.go +++ b/server/model/canteen_rating_tag.go @@ -3,9 +3,9 @@ package model // CanteenRatingTag connects Canteens with ratings type CanteenRatingTag struct { CanteenRatingTag int64 `gorm:"primary_key;AUTO_INCREMENT;column:CafeteriaRatingTag"` - RatingID int64 `gorm:"column:corresponding_rating_id"` + RatingID int64 `gorm:"column:correspondingRating"` //Rating CanteenRating - TagID int64 `gorm:"column:tag_id"` + TagID int64 `gorm:"column:tagID"` //Tag CanteenRatingTagOption Points int32 `gorm:"not null"` } diff --git a/server/model/dish_name_tag.go b/server/model/dish_name_tag.go index 7e9d0b13..47ea423f 100644 --- a/server/model/dish_name_tag.go +++ b/server/model/dish_name_tag.go @@ -1,8 +1,10 @@ package model type DishNameTag struct { - DishNameTag int64 `gorm:"primary_key;AUTO_INCREMENT;column:DishNameTag;type:int;not null;" json:"DishNameTag"` - CorrespondingRating int64 `gorm:"foreignKey:dish;column:correspondingRating;type:int;not null;" json:"correspondingRating"` - Points int32 `gorm:"column:points;type:int;not null;" json:"points"` - TagNameID int64 `gorm:"foreignKey:tagRatingID;column:tagNameID;type:int;not null;" json:"tagnameID"` + DishNameTag int64 `gorm:"primary_key;AUTO_INCREMENT;column:DishNameTag;not null;"` + RatingID int64 `gorm:"foreignKey:dish;column:correspondingRating;not null;"` + //Rating CanteenRating + TagNameID int64 `gorm:"foreignKey:tagRatingID;column:tagNameID;not null;"` + //TagName DishNameTag + Points int32 `gorm:"not null;"` }