diff options
author | Yorhel <git@yorhel.nl> | 2018-09-29 12:00:02 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2018-09-29 12:00:15 +0200 |
commit | 706f447961d18c36ffdc6be34a6eae40acd01574 (patch) | |
tree | 24487342f23fdb01a2c7e4192a05465a2bf19082 /lib/VNDB/DB/Traits.pm | |
parent | 7ca7bb13c3bd79a82b73bdd631399e25fdf6fe81 (diff) |
Add default spoiler level to traits and use it on character edit
https://vndb.org/t11296
Diffstat (limited to 'lib/VNDB/DB/Traits.pm')
-rw-r--r-- | lib/VNDB/DB/Traits.pm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/VNDB/DB/Traits.pm b/lib/VNDB/DB/Traits.pm index 728e4e85..4ed64e3f 100644 --- a/lib/VNDB/DB/Traits.pm +++ b/lib/VNDB/DB/Traits.pm @@ -42,7 +42,7 @@ sub dbTraitGet { ); my @select = ( - qw|t.id t.meta t.name t.description t.state t.alias t."group" t."order" t.sexual t.c_items|, + qw|t.id t.meta t.name t.description t.state t.alias t."group" t."order" t.sexual t.c_items t.defaultspoil|, 'tg.name AS groupname', 'tg."order" AS grouporder', q|extract('epoch' from t.added) as added|, $o{what} =~ /addedby/ ? ('t.addedby', 'u.username') : (), ); @@ -86,7 +86,7 @@ sub dbTraitEdit { $self->dbExec('UPDATE traits !H WHERE id = ?', { $o{upddate} ? ('added = NOW()' => 1) : (), - map exists($o{$_}) ? ("\"$_\" = ?" => $o{$_}) : (), qw|name meta description state alias group order sexual| + map exists($o{$_}) ? ("\"$_\" = ?" => $o{$_}) : (), qw|name meta description state alias group order sexual defaultspoil| }, $id); if($o{parents}) { $self->dbExec('DELETE FROM traits_parents WHERE trait = ?', $id); @@ -99,8 +99,8 @@ sub dbTraitEdit { # returns the id of the new trait sub dbTraitAdd { my($self, %o) = @_; - my $id = $self->dbRow('INSERT INTO traits (name, meta, description, state, alias, "group", "order", sexual, addedby) VALUES (!l, ?) RETURNING id', - [ map $o{$_}, qw|name meta description state alias group order sexual| ], $o{addedby}||$self->authInfo->{id} + my $id = $self->dbRow('INSERT INTO traits (name, meta, description, state, alias, "group", "order", sexual, defaultspoil, addedby) VALUES (!l, ?) RETURNING id', + [ map $o{$_}, qw|name meta description state alias group order sexual defaultspoil| ], $o{addedby}||$self->authInfo->{id} )->{id}; $self->dbExec('INSERT INTO traits_parents (trait, parent) VALUES (?, ?)', $id, $_) for(@{$o{parents}}); return $id; |