From: David ‘Bombe’ Roden Date: Thu, 19 Apr 2012 14:01:25 +0000 (+0200) Subject: Get tracks directly from artist. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=169d70758376ceff8d9161aa8447951f9d206c28;p=demoscenemusic.git Get tracks directly from artist. --- diff --git a/src/main/java/net/pterodactylus/demoscenemusic/page/ArtistPage.java b/src/main/java/net/pterodactylus/demoscenemusic/page/ArtistPage.java index e92726f..45ef5c9 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/page/ArtistPage.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/page/ArtistPage.java @@ -17,11 +17,8 @@ package net.pterodactylus.demoscenemusic.page; -import java.util.Collection; - import net.pterodactylus.demoscenemusic.core.Core; import net.pterodactylus.demoscenemusic.data.Artist; -import net.pterodactylus.demoscenemusic.data.Track; import net.pterodactylus.util.database.DatabaseException; import net.pterodactylus.util.template.Template; import net.pterodactylus.util.template.TemplateContext; @@ -56,11 +53,7 @@ public class ArtistPage extends BasePage { protected void processTemplate(TemplateContext templateContext, ServletRequest request) throws RedirectException { try { Artist artist = getCore().getDataManager().getArtistById(request.getServletRequest().getParameter("id")); - if (artist != null) { - Collection tracks = getCore().getDataManager().getTracksByArtist(artist.id()); - templateContext.set("artist", artist); - templateContext.set("tracks", tracks); - } + templateContext.set("artist", artist); } catch (DatabaseException de1) { /* TODO */ } diff --git a/src/main/resources/templates/artist b/src/main/resources/templates/artist index 655c4d8..9429468 100644 --- a/src/main/resources/templates/artist +++ b/src/main/resources/templates/artist @@ -8,7 +8,7 @@

Tracks by <% artist.name|html>

-<%foreach tracks track|sort> +<%foreach artist.tracks track|sort> <%first><%/last>