Skip to content

Commit

Permalink
tested different rating tags
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Aug 23, 2024
1 parent 7d76609 commit 23a9716
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions server/backend/cafeteria.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
}
Expand Down
4 changes: 2 additions & 2 deletions server/model/canteen_rating_tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
10 changes: 6 additions & 4 deletions server/model/dish_name_tag.go
Original file line number Diff line number Diff line change
@@ -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;"`
}

0 comments on commit 23a9716

Please sign in to comment.