From 93f07208cd76a81b3f169d5de8db0c5ff3fc5545 Mon Sep 17 00:00:00 2001 From: Anton Maminov Date: Mon, 23 Dec 2024 14:08:59 +0200 Subject: [PATCH] fix ameba warnings --- src/models/repository.cr | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/models/repository.cr b/src/models/repository.cr index 7754f3c..d7b3fb3 100644 --- a/src/models/repository.cr +++ b/src/models/repository.cr @@ -44,14 +44,14 @@ class Repository scope(:published) { where({ignore: false}) } - scope(:without_releases) { + scope(:without_releases) do where(<<-SQL NOT ( EXISTS (SELECT "releases".* FROM "releases" WHERE (releases.repository_id = repositories.id)) ) SQL ) - } + end # ``` # repositories = Repository.query.with_counts @@ -61,7 +61,7 @@ class Repository # repository.attributes["dependents_count"] # end # ``` - scope(:with_counts) { + scope(:with_counts) do self .select( "repositories.*", @@ -69,18 +69,18 @@ class Repository "(select COUNT(*) from relationships r WHERE r.master_id=repositories.id) dependencies_count" ) .group_by("repositories.id") - } + end def self.find_repository(user_login : String, repository_name : String, provider : String) : Repository? Repository .query .join("users") { users.id == repositories.user_id } - .find { + .find do (users.login == user_login) & (users.provider == provider) & (repositories.provider == provider) & (repositories.name == repository_name) - } + end end def decorate