Fix registry dumb creating invalid csv file
This commit is contained in:
parent
486c9b00c9
commit
028d03b147
@ -1611,6 +1611,22 @@ object MatterManager {
|
||||
|
||||
val stream2 = stream.map { it to get(it.value) }
|
||||
|
||||
fun writeValue(a: String, b: String, c: String, commentary: Collection<String>) {
|
||||
if (commentary.size < 2) {
|
||||
writer.write(arrayOf(a, b, c, commentary.firstOrNull() ?: "").joinToString(";", transform = ::transformQuotes))
|
||||
writer.write("\n")
|
||||
} else {
|
||||
val iterator = commentary.iterator()
|
||||
writer.write(arrayOf(a, b, c, iterator.next()).joinToString(";", transform = ::transformQuotes))
|
||||
writer.write("\n")
|
||||
|
||||
for (v in iterator) {
|
||||
writer.write(arrayOf("", "", "", v).joinToString(";", transform = ::transformQuotes))
|
||||
writer.write("\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ((entry, value) in filter.filter(stream2)) {
|
||||
val (key, item) = entry
|
||||
val isBlacklisted: Boolean
|
||||
@ -1624,16 +1640,14 @@ object MatterManager {
|
||||
}
|
||||
|
||||
if (isBlacklisted) {
|
||||
writer.write(arrayOf(key.location().toString(), "---", "---", "Item is blacklisted from having matter value").joinToString(";", transform = ::transformQuotes))
|
||||
writeValue(key.location().toString(), "---", "---", listOf("Item is blacklisted from having matter value"))
|
||||
} else {
|
||||
if (!value.hasMatterValue) {
|
||||
writer.write(arrayOf(key.location().toString(), "", "", commentary[item]?.joinToString("\n", transform = { transformQuotes(it.string) }) ?: "").joinToString(";", transform = ::transformQuotes))
|
||||
writeValue(key.location().toString(), "", "", commentary[item]?.map { it.string } ?: listOf())
|
||||
} else {
|
||||
writer.write(arrayOf(key.location().toString(), value.matter.toString(), value.complexity.toString(), commentary[item]?.joinToString("\n", transform = { transformQuotes(it.string) }) ?: "").joinToString(";", transform = ::transformQuotes))
|
||||
writeValue(key.location().toString(), value.matter.toString(), value.complexity.toString(), commentary[item]?.map { it.string } ?: listOf())
|
||||
}
|
||||
}
|
||||
|
||||
writer.write("\n")
|
||||
}
|
||||
|
||||
writer.close()
|
||||
|
Loading…
Reference in New Issue
Block a user