Improvements to the Excel export of projects ()

The research area column show the string "null" instead of being an empty cell for projects without a research area. This has been fixed everywhere and not just on the project export.

The reviewer column showed weird technical details (`User#toString()`) instead of the reviewers name.

## How to test
1. On `develop` branch
2. Log in as the default admin
3. Go to "Project management / Projects"
4. Click "Excel export" under the table
5. Open the file and see
6. Repeat 1-5 on this branch

Co-authored-by: Nico Athanassiadis <nico@dsv.su.se>
Reviewed-on: 
Reviewed-by: Nico Athanassiadis <nico@dsv.su.se>
Co-authored-by: Andreas Svanberg <andreass@dsv.su.se>
Co-committed-by: Andreas Svanberg <andreass@dsv.su.se>
This commit is contained in:
Andreas Svanberg 2025-03-05 14:07:47 +01:00 committed by Nico Athanassiadis
parent ed365bd7f5
commit 23e0a7f5ea
2 changed files with 8 additions and 4 deletions
view/src/main/java/se/su/dsv/scipro

@ -1,6 +1,5 @@
package se.su.dsv.scipro.datatables.project;
import com.google.common.eventbus.EventBus;
import jakarta.inject.Inject;
import java.util.*;
import org.apache.wicket.ajax.AjaxRequestTarget;
@ -33,7 +32,6 @@ import se.su.dsv.scipro.components.datatables.MultipleUsersColumn;
import se.su.dsv.scipro.components.datatables.UserColumn;
import se.su.dsv.scipro.dataproviders.FilteredDataProvider;
import se.su.dsv.scipro.datatables.AjaxCheckboxWrapper;
import se.su.dsv.scipro.notifications.NotificationController;
import se.su.dsv.scipro.profile.UserLinkPanel;
import se.su.dsv.scipro.project.Project;
import se.su.dsv.scipro.project.ProjectService;
@ -45,7 +43,6 @@ import se.su.dsv.scipro.system.ProjectType;
import se.su.dsv.scipro.system.ProjectTypeService;
import se.su.dsv.scipro.system.ResearchArea;
import se.su.dsv.scipro.system.User;
import se.su.dsv.scipro.system.UserService;
import se.su.dsv.scipro.util.PageParameterKeys;
public class ProjectDataPanel extends Panel {
@ -170,6 +167,11 @@ public class ProjectDataPanel extends Panel {
) {
cellItem.add(new ReviewerColumnCell(componentId, rowModel));
}
@Override
public IModel<?> getDataModel(IModel<Project> rowModel) {
return rowModel.map(Project::getReviewer).map(User::getFullName);
}
};
}

@ -72,7 +72,9 @@ public class ExcelExporter extends AbstractDataExporter {
for (int i = 0; i < columns.size(); i++) {
Object cellValue = columns.get(i).getDataModel(data).getObject();
Cell cell = row.createCell(i);
cell.setCellValue(String.valueOf(cellValue));
if (cellValue != null) {
cell.setCellValue(cellValue.toString());
}
}
}
}