Ghostwriter icon indicating copy to clipboard operation
Ghostwriter copied to clipboard

Report template types are broken

Open smcgu opened this issue 1 year ago • 4 comments

Describe the bug

Report templates show the incorrect type and the Document Type drop-down has empty options.

To Reproduce

Steps to reproduce the behavior:

  1. Go to Report Template Library -> DOCX templates show the PowerPoint icon
  2. Click on a template -> The "PowerPoint" badge is visible under the template name
  3. Edit the template
  4. Expand the Document Type drop-down -> two empty selections and "Project DOCX"

Expected Behavior

Report templates should be correctly associated with their document type in the Report Template Library view and in an individual report template view.

Screenshots

Shared over Slack. Unable to upload here.

Server Specs:

  • OS: Ubuntu 22.04
  • Docker: Docker version 26.1.1, build 4cf5afa
  • Docker Compose: Docker Compose version v2.27.0
  • Ghostwriter: v4.2.0, released 15 May 2024

Additional context

Reverting to v4.1.0 (tag/release) resolved the behavior.

smcgu avatar May 16 '24 01:05 smcgu

Hey @smcgu, it's best to use the code in main or the latest archive of the latest release. The v4.2 development branch is not ready for production use right now.

That said, it sounds like your database was not properly seeded after you updated. You need to re-build the containers to ensure the database has the proper default values. In this case, the values are the names of the document types. This is new in the upcoming v4.2 release. If the initial values aren't loaded, you'll see empty entries in the drop-down because the name values are missing. This also leads to incorrect icons displayed for docx and pptx templates on the template library page.

chrismaddalena avatar May 16 '24 03:05 chrismaddalena

Thank you for the quick response. The containers were rebuilt and I tested the process twice. The process was:

  1. git pull
  2. git switch v4-1-dev
  3. git log # to verify latest commits
  4. ./ghostwriter-cli-linux containers down
  5. ./ghostwriter-cli-linux containers build
  6. ./ghostwriter-cli-linux containers up

The templates were properly listed and typed before this process. So, it is something in the upgrade process or changes.

And, yes, I am aware of that the dev branch is less stable. This was tested on a restricted, limited use installation.

smcgu avatar May 16 '24 05:05 smcgu

Alex and I were just chatting and we found the issue. Ghostwriter CLI tries to not step on any database customizations you may have made. In this case, two of the three entries already exist and the new fixtures modify them. The build command skips loading the fixtures because the entries already exist. That's why you end up with blank name fields.

You can fix that manually with this command. We'll look at updating how we try to handle fixtures for the release.

docker compose -f production.yml run --rm django python manage.py loaddata --force ghostwriter/reporting/fixtures/initial.json

chrismaddalena avatar May 16 '24 17:05 chrismaddalena

This issue has been labeled as stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Jun 16 '24 09:06 github-actions[bot]

This issue is closed because it has been inactive for 14 days since being labeled stale. Feel free to re-open the issue with a comment. If this needs further discussion (e.g., a feature request), it might be better to open a topic under the Discussions tab.

github-actions[bot] avatar Jul 01 '24 09:07 github-actions[bot]