Skip to content
Snippets Groups Projects
Commit 31a72f55 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

#691 - fixed tag importer (tags dont have ids in json)

parent 53ea7c74
Branches
Tags
No related merge requests found
...@@ -26,7 +26,7 @@ public class TagImporter extends ItemImporter<Tag> ...@@ -26,7 +26,7 @@ public class TagImporter extends ItemImporter<Tag>
return newTag.getID(); return newTag.getID();
} }
return tag.getID(); return existingTag.getID();
} }
@Override @Override
......
...@@ -11,7 +11,7 @@ public enum EntityType implements LocalizedEnum ...@@ -11,7 +11,7 @@ public enum EntityType implements LocalizedEnum
CHART("show_chart", "background-purple", ImportRequired.OPTIONAL, "charts", "chart"), CHART("show_chart", "background-purple", ImportRequired.OPTIONAL, "charts", "chart"),
REPORT("description", "background-green", ImportRequired.NONE, null, null), REPORT("description", "background-green", ImportRequired.NONE, null, null),
CATEGORY("label", "background-orange", ImportRequired.REQUIRED, "categories", "category"), CATEGORY("label", "background-orange", ImportRequired.REQUIRED, "categories", "category"),
TAGS("local_offer", "background-grey", ImportRequired.NONE, null, null), TAGS("local_offer", "background-grey", ImportRequired.NONE, "tags", "tag"),
STATISTICS("insert_chart", "background-grey", ImportRequired.NONE, null, null), STATISTICS("insert_chart", "background-grey", ImportRequired.NONE, null, null),
SETTINGS("settings", "background-red", ImportRequired.NONE, null, null), SETTINGS("settings", "background-red", ImportRequired.NONE, null, null),
IMAGE("image", "background-grey", ImportRequired.REQUIRED, "images", "image"), IMAGE("image", "background-grey", ImportRequired.REQUIRED, "images", "image"),
......
...@@ -185,11 +185,6 @@ class TemplateImporterTest ...@@ -185,11 +185,6 @@ class TemplateImporterTest
Icon icon = new Icon("fas fa-icons"); Icon icon = new Icon("fas fa-icons");
icon = iconRepository.save(icon); icon = iconRepository.save(icon);
final Tag tag1 = new Tag("0815");
tag1.setID(1);
final Tag tag2 = new Tag("Apple Pie");
tag2.setID(2);
final Template template = new Template(); final Template template = new Template();
template.setID(15); template.setID(15);
template.setTemplateName("My awesome template"); template.setTemplateName("My awesome template");
...@@ -201,7 +196,7 @@ class TemplateImporterTest ...@@ -201,7 +196,7 @@ class TemplateImporterTest
template.setTags(List.of()); template.setTags(List.of());
template.setDescription("Lorem Ipsum"); template.setDescription("Lorem Ipsum");
template.setIconReference(icon); template.setIconReference(icon);
template.setTags(List.of(tag1, tag2)); template.setTags(List.of( new Tag("0815"), new Tag("Apple Pie")));
final Template template2 = new Template(); final Template template2 = new Template();
template2.setID(16); template2.setID(16);
...@@ -210,7 +205,7 @@ class TemplateImporterTest ...@@ -210,7 +205,7 @@ class TemplateImporterTest
template2.setTags(List.of()); template2.setTags(List.of());
template2.setDescription("Lorem Ipsum"); template2.setDescription("Lorem Ipsum");
template2.setIconReference(icon); template2.setIconReference(icon);
template2.setTags(List.of(tag1)); template2.setTags(List.of( new Tag("0815")));
TemplateGroup defaultTemplateGroup = new TemplateGroup("Default group", TemplateGroupType.DEFAULT); TemplateGroup defaultTemplateGroup = new TemplateGroup("Default group", TemplateGroupType.DEFAULT);
defaultTemplateGroup = templateGroupRepository.save(defaultTemplateGroup); defaultTemplateGroup = templateGroupRepository.save(defaultTemplateGroup);
......
...@@ -213,9 +213,7 @@ class TransactionImporterTest ...@@ -213,9 +213,7 @@ class TransactionImporterTest
transaction.setDescription("Lorem Ipsum"); transaction.setDescription("Lorem Ipsum");
final Tag tag1 = new Tag("0815"); final Tag tag1 = new Tag("0815");
tag1.setID(1);
final Tag tag2 = new Tag("Apple Pie"); final Tag tag2 = new Tag("Apple Pie");
tag2.setID(2);
transaction.setTags(List.of(tag1, tag2)); transaction.setTags(List.of(tag1, tag2));
...@@ -258,10 +256,6 @@ class TransactionImporterTest ...@@ -258,10 +256,6 @@ class TransactionImporterTest
Account account = new Account("Awesome Account", AccountType.CUSTOM); Account account = new Account("Awesome Account", AccountType.CUSTOM);
account = accountRepository.save(account); account = accountRepository.save(account);
final Tag tag1 = new Tag("0815");
tag1.setID(1);
final Tag tag2 = new Tag("Apple Pie");
tag2.setID(2);
final Transaction transaction = new Transaction(); final Transaction transaction = new Transaction();
transaction.setID(15); transaction.setID(15);
...@@ -271,7 +265,7 @@ class TransactionImporterTest ...@@ -271,7 +265,7 @@ class TransactionImporterTest
transaction.setCategory(category); transaction.setCategory(category);
transaction.setAccount(account); transaction.setAccount(account);
transaction.setDate(LocalDate.of(2022, 3, 30)); transaction.setDate(LocalDate.of(2022, 3, 30));
transaction.setTags(List.of(tag1, tag2)); transaction.setTags(List.of(new Tag("0815"), new Tag("Apple Pie")));
final Transaction transaction2 = new Transaction(); final Transaction transaction2 = new Transaction();
transaction2.setID(16); transaction2.setID(16);
...@@ -281,7 +275,7 @@ class TransactionImporterTest ...@@ -281,7 +275,7 @@ class TransactionImporterTest
transaction2.setCategory(category); transaction2.setCategory(category);
transaction2.setAccount(account); transaction2.setAccount(account);
transaction2.setDate(LocalDate.of(2022, 3, 30)); transaction2.setDate(LocalDate.of(2022, 3, 30));
transaction2.setTags(List.of(tag1)); transaction2.setTags(List.of(new Tag("0815")));
final TagImporter tagImporter = new TagImporter(tagRepository); final TagImporter tagImporter = new TagImporter(tagRepository);
final TransactionImporter importer = new TransactionImporter(transactionRepository, tagImporter); final TransactionImporter importer = new TransactionImporter(transactionRepository, tagImporter);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment