mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 20:44:32 -05:00
Shorten hidden category names imported from YNAB4 (#3122)
Imported hidden categories had the parent category entity id (UUID) appended to the end of the name, making the category name quite long and somewhat hard to read. Remove the entity id from the end, and replace the apostrophe that divides the master category from the sub category with a forward slash. This shortens the name, ensuring a better chance that the full category name fits into the default table cell width. Co-authored-by: DJ Mountney <david@twkie.net>
This commit is contained in:
@@ -71,8 +71,24 @@ async function importCategories(
|
||||
// on insertion order
|
||||
for (const category of subCategories) {
|
||||
if (!category.isTombstone) {
|
||||
let categoryName = category.name;
|
||||
|
||||
// Hidden categories have the parent category entity id
|
||||
// appended to the end of the sub category name.
|
||||
// The format is 'MasterCategory ` SubCategory ` entityId'.
|
||||
// Remove the id to shorten the name.
|
||||
if (masterCategory.name === 'Hidden Categories') {
|
||||
const categoryNameParts = categoryName.split(' ` ');
|
||||
|
||||
// Remove the last part, which is the entityId.
|
||||
categoryNameParts.pop();
|
||||
|
||||
// Join the remaining parts with a slash between them.
|
||||
categoryName = categoryNameParts.join('/').trim();
|
||||
}
|
||||
|
||||
const id = await actual.createCategory({
|
||||
name: category.name,
|
||||
name: categoryName,
|
||||
group_id: entityIdMap.get(category.masterCategoryId),
|
||||
});
|
||||
entityIdMap.set(category.entityId, id);
|
||||
|
||||
6
upcoming-release-notes/3122.md
Normal file
6
upcoming-release-notes/3122.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Enhancements
|
||||
authors: [alcroito]
|
||||
---
|
||||
|
||||
Shorten hidden category names imported from YNAB4.
|
||||
Reference in New Issue
Block a user