added number of project ideas to a statistics panel

This commit is contained in:
Fredrik Friis 2012-03-23 15:28:23 +09:00
parent f53249cc67
commit 0dc36a1d2b
2 changed files with 8 additions and 6 deletions

@ -7,7 +7,7 @@
<table class="rounded-corner">
<thead>
<tr>
<th class="rounded-left-top">Application period</th><th>End date</th><th>Number of students</th>
<th class="rounded-left-top">Application period</th><th>End date</th><th>Number of students</th><th>Number of project ideas</th>
</tr>
</thead>
<tbody>
@ -16,11 +16,12 @@
<td wicket:id="applicationPeriodName"></td>
<td wicket:id="applicationPeriodEndDate"></td>
<td wicket:id="numberOfStudents"></td>
<td wicket:id="numberOfPIs"></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="5" class="rounded-foot">&nbsp;</td>
<td colspan="6" class="rounded-foot">&nbsp;</td>
</tr>
</tfoot>
</table>

@ -1,7 +1,5 @@
package se.su.dsv.scipro.admin.panels;
import java.util.List;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.navigation.paging.PagingNavigator;
@ -9,12 +7,13 @@ import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.DataView;
import org.apache.wicket.spring.injection.annot.SpringBean;
import se.su.dsv.scipro.match.dao.interfaces.ApplicationPeriodDao;
import se.su.dsv.scipro.match.dataobject.ApplicationPeriod;
import se.su.dsv.scipro.match.dataobject.ProjectIdea;
import se.su.dsv.scipro.match.dataprovider.ProjectIdeaStatisticDataProvider;
import java.util.List;
public class AdminProjectIdeaStatisticPanel extends Panel {
private static final long serialVersionUID = 1L;
@ -61,13 +60,15 @@ public class AdminProjectIdeaStatisticPanel extends Panel {
protected void populateItem(Item<ApplicationPeriod> item) {
List<ProjectIdea> projectIdeas = applicationPeriodDao.getProjectIdeas(item.getModelObject());
int students = 0;
int projectIdeasNo = 0;
for (ProjectIdea pi : projectIdeas){
students += pi.getAuthors().size();
projectIdeasNo ++;
}
item.add(new Label("applicationPeriodName", ""+item.getModelObject().getName()));
item.add(new Label("applicationPeriodEndDate", ""+item.getModelObject().getEndDate()));
item.add(new Label("numberOfStudents", ""+students));
item.add(new Label("numberOfPIs", ""+projectIdeasNo));
}
};