diff options
author | Yorhel <git@yorhel.nl> | 2010-11-10 21:01:14 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2010-11-10 21:04:37 +0100 |
commit | 15808bc64c7717c0a157c24ee9bfd0a097daf707 (patch) | |
tree | cc8782101c744ae43f6f9e2529ce85582c892600 /lib/VNDB/DB/VN.pm | |
parent | 134ebe506dc37073b474a83a5c3a3ab33fa411a1 (diff) |
Started on adding an "official" flag to vn<->vn relations
This is the first part. The flag is stored in the database, can be
edited through the usual VN edit form, and is displayed in the diff
viewer.
Things to do to make this feature fully functional:
- display "official" status on VN page at the relation listing
- update relation graphs to display unofficial relations differently
- update guidelines
Diffstat (limited to 'lib/VNDB/DB/VN.pm')
-rw-r--r-- | lib/VNDB/DB/VN.pm | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/VNDB/DB/VN.pm b/lib/VNDB/DB/VN.pm index 0088d18f..6d99ba8a 100644 --- a/lib/VNDB/DB/VN.pm +++ b/lib/VNDB/DB/VN.pm @@ -125,11 +125,12 @@ sub dbVNGet { if($o{what} =~ /relations/) { push(@{$r->[$r{$_->{vid1}}]{relations}}, { relation => $_->{relation}, + official => $_->{official}, id => $_->{vid2}, title => $_->{title}, - original => $_->{original} + original => $_->{original}, }) for(@{$self->dbAll(q| - SELECT rel.vid1, rel.vid2, rel.relation, vr.title, vr.original + SELECT rel.vid1, rel.vid2, rel.relation, rel.official, vr.title, vr.original FROM vn_relations rel JOIN vn v ON rel.vid2 = v.id JOIN vn_rev vr ON v.latest = vr.id @@ -176,9 +177,9 @@ sub dbVNRevisionInsert { if($o->{relations}) { $self->dbExec('DELETE FROM edit_vn_relations'); - my $q = join ',', map '(?, ?)', @{$o->{relations}}; - my @val = map +($_->[1], $_->[0]), @{$o->{relations}}; - $self->dbExec("INSERT INTO edit_vn_relations (vid, relation) VALUES $q", @val) if @val; + my $q = join ',', map '(?, ?, ?)', @{$o->{relations}}; + my @val = map +($_->[1], $_->[0], $_->[2]?1:0), @{$o->{relations}}; + $self->dbExec("INSERT INTO edit_vn_relations (vid, relation, official) VALUES $q", @val) if @val; } if($o->{anime}) { |