Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/release-notes/6.9-release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ See [the guides](https://guides.dataverse.org/en/6.9/developers/workflows.html#c
- In prior versions of Dataverse, publishing a dataset via the superuser-only update-current-version option would not set the current curation status (if enabled/used) to none/empty and, in v6.7, would not maintain the curation status history. These issues are now resolved and the update-current-version option works the same as normal publication of a new version with regard to curation status. See #11783 and #11784.
- This release fixes problems with guestbook questions being displayed at download when files are selected from the dataset files table when guestbook-at-request is enabled and not displaying when they should when access is requested from the file page. See #11800, #11808, and #11835.
- The optional Croissant exporter has been updated to 0.1.6 to prevent variable names, variable descriptions, and variable types from being exposed for restricted files. See https://github.com/gdcc/exporter-croissant/pull/20 and #11752.
- Manage Gustbooks page was optimized to load much faster for collections with large numbers of downloads recorded.

## API Updates

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
@Index(columnList = "datafile_id"),
@Index(columnList = "datasetversion_id"),
@Index(columnList = "authenticateduser_id"),
@Index(columnList = "dataset_id")
@Index(columnList = "dataset_id"),
@Index(columnList = "dataset_id, guestbook_id", name="INDEX_GUESTBOOKRESPONSE_dataset_id_guestbook_id")
})

@NamedQueries(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,17 +488,25 @@ public Long findCount30Days(Long dataverseId) {
return (Long) query.getSingleResult();
}

public Long findCountAll() {
return findCountAll(null);
}

public Long findCountAll(Long dataverseId) {
String queryString;
if (dataverseId != null) {
queryString = "select count(o.id) from GuestbookResponse o, DvObject v where o.dataset_id = v.id and v.owner_id = " + dataverseId + " ";
} else {
queryString = "select count(o.id) from GuestbookResponse o ";

if (dataverseId == null) {
return null;
}

// Note that this method used to support NULL dataverseId,
// in which case it counted ALL the guestbookresponse rows
// for the entire instance:
// queryString = "select count(o.id) from GuestbookResponse o ";
// I removed this code (it was not being used, thankfully) since
// the query can be insanely expensive on a large production table.
// That's why we use a stored procedure to "estimate" its size, in
// the dedicated getTotalDownloadCount() method further below, for
// example, when we need to show the total number of downloads on
// the homepage. (L.A.)

String queryString = "select count(o.id) from GuestbookResponse o, DvObject v, Dataset d where o.dataset_id = v.id and v.id = d.id and v.owner_id = " + dataverseId + " ";


Query query = em.createNativeQuery(queryString);
return (Long) query.getSingleResult();
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/db/migration/V6.8.0.4.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE INDEX IF NOT EXISTS INDEX_GUESTBOOKRESPONSE_dataset_id_guestbook_id ON GUESTBOOKRESPONSE (dataset_id, guestbook_id);