Ghostwriter icon indicating copy to clipboard operation
Ghostwriter copied to clipboard

Add report version

Open mynoc96 opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe.

You can track project notes, but there doesn't appear to be a way to track report versions.

Describe the solution you'd like

Ideally a versions or revisions list under reports to track the user, date, version/revision number, and a note.

Describe alternatives you've considered

Adding notes to the report and parsing the text there (that would probably require a split jinja filter).

Additional context

None

mynoc96 avatar Sep 30 '24 16:09 mynoc96

We could consider making this a default value, but you can get what you want with more flexibility via a custom field. I explained this in your related issue, #532.

The custom field allows you to pick the field type: string, integer (whole numbers), or number (allows for decimal values). The best choice for you will depend on what you want a report version to look like.

chrismaddalena avatar Sep 30 '24 21:09 chrismaddalena

I think I described it badly when I said version. What I was trying to say was "version history". The use case case here would be for tracking changes over the course of the engagement, so would probably need to use some kind of a list of tuples like: [revision1: ((user: string, date: string, revision/version: string, note: string)), revision2, revision3, etc. ] to be able to create a templated table like:

Author Date Revision Description
Somebody Some date Some arbitrary revision number Some description
Somebody else Some other date Some other arbitrary revision number Some other description

The user could be whoever creates the record.

Tracking the history, though would require multiple records to create a table. That is why I created the other issue. I went to parse an existing field (I was going to use the project note table), but there was no "split" filter to break out thew newlines. I was going to enter some notes in the following form, parse them out, and if the record was in the right form, throw them into a revision table. Basically, I was going to create a note (which is an rt field by default) like:

revision
1.0
September 22, 2024
Initial release

Then I could take the note and do the following:

{% if note|strip_html|split|get_item(0) == "revision" %}, which I expected to convert rich text with html to plain text with newlines, use the newlines to create a list of strings, and get the first string to check if the string contains "revision", then build a table like:

Author Date Revision Description
{%tr for note in project.notes %}
note.user note strip_html split
%{tr endfor %}

That's when I realized "split" wasn't implemented.

mynoc96 avatar Oct 01 '24 13:10 mynoc96

You can call Python's split like this: https://github.com/GhostManager/Ghostwriter/issues/532#issuecomment-2386431709

You might be better off making your custom field a formatted text field with a table for your specific use case. As changes are made, the user can add their change notes to the table like a CHANGELOG. Have you tried that?

It would remove the need for the user to update a string with specific requirements and to split and loop over the results in a template.

We could still consider adding some sort of custom split filter.

chrismaddalena avatar Oct 11 '24 16:10 chrismaddalena

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

github-actions[bot] avatar Nov 11 '24 09:11 github-actions[bot]

Thanks. I used the approach you pointed out.

mynoc96 avatar Nov 22 '24 15:11 mynoc96