From: Tara L Andrews <tla@mit.edu>
Date: Tue, 7 Feb 2012 11:11:06 +0000 (+0100)
Subject: add SVG caching
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b9a04e241476c923eace68048a1eb574cbff90ce;p=scpubgit%2Fstemmaweb.git

add SVG caching
---

diff --git a/lib/stemmaweb/Controller/Root.pm b/lib/stemmaweb/Controller/Root.pm
index de51958..23971b6 100644
--- a/lib/stemmaweb/Controller/Root.pm
+++ b/lib/stemmaweb/Controller/Root.pm
@@ -70,9 +70,11 @@ Returns the variant graph for the text specified at $textid, in SVG form.
 sub variantgraph :Local :Args(1) {
 	my( $self, $c, $textid ) = @_;
 	my $m = $c->model('Directory');
-	my $collation = $m->tradition( $textid )->collation;
-
+	my $tradition = $m->tradition( $textid );
+	my $collation = $tradition->collation;
+	my $needsave = !$collation->has_cached_svg;
 	$c->stash->{'result'} = $collation->as_svg;
+	$m->save( $tradition );
 	$c->forward('View::SVG');
 }