Fixup graph_by_name

Graph details page doesn't work after merging in PR59.

This is a quick fixup however there is some duplicate code that should probably be removed