From 3a6dd311bfa58d9f8e40d532a1719387a0f101b4 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 17 Dec 2024 16:30:42 -0800 Subject: [PATCH] submissions: wrong query --- pkg/datastore/gormstore/script_policy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/datastore/gormstore/script_policy.go b/pkg/datastore/gormstore/script_policy.go index d8dbb97..fb9aef1 100644 --- a/pkg/datastore/gormstore/script_policy.go +++ b/pkg/datastore/gormstore/script_policy.go @@ -26,7 +26,7 @@ func (env *ScriptPolicy) Get(ctx context.Context, id int64) (model.ScriptPolicy, func (env *ScriptPolicy) GetFromHash(ctx context.Context, hash uint64) (model.ScriptPolicy, error) { var mdl model.ScriptPolicy - if err := env.db.Model(&model.ScriptPolicy{}).Where("hash = ?", hash).Error; err != nil { + if err := env.db.Take(&mdl,"from_script_hash = ?", hash).Error; err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { return mdl, datastore.ErrNotExist }