Skip to content

Commit e057b5f

Browse files
committed
fix(model-sync-lib): fixed import stats not being reset
1 parent 1c73be5 commit e057b5f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

model-sync-lib/src/main/kotlin/org/modelix/model/sync/ImportStats.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ class ImportStats {
3838

3939
fun getTotal() : Int = additions.size + deletions.size + moves.size + propertyChanges.size + referenceChanges.size
4040

41+
fun reset() {
42+
listOf(additions, deletions, moves, propertyChanges, referenceChanges).forEach {
43+
(it as MutableList).clear()
44+
}
45+
}
46+
4147
}
4248

4349
interface NodeChange {

model-sync-lib/src/main/kotlin/org/modelix/model/sync/ModelImporter.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class ModelImporter(private val root: INode, val stats: ImportStats? = null) {
1616
}
1717

1818
fun import(data: ModelData) {
19+
stats?.reset()
20+
1921
syncProperties(root, data.root) // root original id is required for following operations
2022
val allExistingNodes = root.getDescendants(true).toList()
2123
val originalIdToSpec: MutableMap<String, NodeData> = buildSpecIndex(data.root)

0 commit comments

Comments
 (0)