GnuCash
Contact   Instructions
Bug 796887 - Remove <slot:key>color</slot:key> instead of setting <slot:value type="string">Not Set</slot:value>
Summary: Remove <slot:key>color</slot:key> instead of setting <slot:value type="string...
Status: RESOLVED FIXED
Alias: None
Product: GnuCash
Classification: Unclassified
Component: Backend - XML (show other bugs)
Version: 3.2
Hardware: PC Linux
: Normal normal
Target Milestone: ---
Assignee: core
QA Contact: core
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-05 02:10 EDT by Frank H. Ellenberger
Modified: 2018-12-25 14:16 EST (History)
6 users (show)

See Also:


Attachments

Description Frank H. Ellenberger 2018-10-05 02:10:07 EDT
While working on the updated account templates from Bug 795425 et al., I watched a significant increase of their size. The cause is: every account where the color is unused/was reset to default, gets a slot added:
  <act:slots>
    <slot>
      <slot:key>color</slot:key>
      <slot:value type="string">Not Set</slot:value>
    </slot>
  </act:slots>

IMHO this is annoying and makes it much harder to read (the diff of) a template.
It costs disk space and scan time,...
Is it raelly necessary?

I assume the slots are also added in SQL.
Comment 1 Bob 2018-12-21 05:08:07 EST
Not sure why you got that for every account as by default there should be no entry, add a colour you get a entry with the colour in it, select the default button you will end up with a slot with 'Not Set'.

I have changed this in PR442 so the slot is deleted when the default button is used. There is no clean up as part of this but if the account is edited the 'Not Set' value will be removed. If you want to do it on mass, export the account tree to CSV and then just import it back which should remove all 'Not Set' values. ## MAKE SURE ## you backup first just in case.
Comment 2 Frank H. Ellenberger 2018-12-21 20:26:46 EST
(In reply to Bob from comment #1)
> Not sure why you got that for every account as by default there should be no
> entry, add a colour you get a entry with the colour in it, select the
> default button you will end up with a slot with 'Not Set'.

I don't know, how Christoph got them.
 
> I have changed this in PR442 so the slot is deleted when the default button
> is used.

> There is no clean up as part of this but if the account is edited
> the 'Not Set' value will be removed. If you want to do it on mass, export
> the account tree to CSV and then just import it back which should remove all
> 'Not Set' values. ## MAKE SURE ## you backup first just in case.

John, perhaps this section should go in the release notes?
Comment 3 John Ralls 2018-12-21 23:21:52 EST
I reviewed the PR and had only one comment unrelated to this bug. It shouldn't take Bob long to address the comment so I expect I'll merge the PR tomorrow or Sunday. The fact that the bug is fixed will then go into the release notes. 

Bob, I don't use account colors, yet in my primary book 640 out of 763 accounts have a color slot with the value "Not Set". ISTM there was some other way that slot was being created. Maybe a scrub is warranted.
Comment 4 Bob 2018-12-22 13:27:42 EST
Turns out I was wrong, it gets set on every edit of an account. I was sure that was not the case but had to load a 2.4.10 version to confirm it has always been like that, strange it was not noticed earlier.

I have added a scrub routine to the PR which removes all the "Not Set" slots. No doubt it will need fine tuning so will wait feedback on PR.
Comment 5 Geert Janssens 2018-12-22 15:10:59 EST
How will old code react if the slot no longer exists ? Will it continue to work (likely re-adding the slots in that case ?
Comment 6 Bob 2018-12-22 15:23:55 EST
I see no reason for it not to work, by default the slot is not there any way. Yes if an old version opens the file and edits an account the slot will be added back but I do not see that as an issue, I doubt there would be many occasions like that and I don't think it warrants a feature. But I may be looking at it to simply.
Comment 7 Geert Janssens 2018-12-23 07:18:00 EST
I totally agree a feature would be overkill here.

I asked without really thinking it through based on John's comment 3 in which he states most of his accounts have the slot. On the other hand it also means there are accounts in his book that don't have the slot, yet work fine. That should answer my question.
Comment 8 John Ralls 2018-12-25 14:16:29 EST
PR442 pushed to maint, this will go into GnuCash 3.4.

Note You need to log in before you can comment on or make changes to this bug.