Added more bugs

master
E. Almqvist 3 years ago
parent 34bcffe9ba
commit ea88425e39
  1. 6
      src/db_models.rb
  2. 2
      src/sql/tables/Role.sql

@ -18,6 +18,9 @@ class User < EntityModel
end
def role
p "######################"
p roles
p "######################"
if roles.length > 0 then
role = roles.max_by { |role| role.flags }
return role.name
@ -147,8 +150,11 @@ end
class User_Role_relation < EntityModel
def self.get_user_roles(user_id)
roleids = self.get "role_id", "user_id = ?", user_id
p roleids
roles = roleids.map do |ent|
Role.find_by_id(ent["role_id"].to_i)
end
p roles
return roles
end
end

@ -1,7 +1,7 @@
CREATE TABLE IF NOT EXISTS "Role" (
"id" INTEGER NOT NULL UNIQUE,
"name" TEXT NOT NULL,
"color" TEXT NOT NULL DEFAULT "#ffffff",
"color" TEXT NOT NULL DEFAULT '#ffffff',
"flags" INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY("id" AUTOINCREMENT)
);

Loading…
Cancel
Save