Skip to content

Commit

Permalink
Fixed bug in tasks whereby the results csv was not being generated (2…
Browse files Browse the repository at this point in the history
…600hz#6513)

correctly due to changes to the csv generator to add a new line charter
to the end of lines
  • Loading branch information
bradfordben authored May 1, 2020
1 parent 379fbfe commit 73a6ee0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions applications/tasks/src/kz_tasks_scheduler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,11 @@ maybe_strip_columns(Columns, CSVPath, ColumnsWritten) ->
strip_columns(FullHeader, Header, CSV, OutputPath) ->
case kz_csv:take_mapped_row(FullHeader, CSV) of
'eof' ->
'ok' = file:write_file(OutputPath, [kz_csv:row_to_iolist(Header), $\n], ['append']),
'ok' = file:write_file(OutputPath, kz_csv:row_to_iolist(Header), ['append']),
tac(OutputPath);
{MappedRow, NewCSV} ->
Stripped = maps:with(Header, MappedRow),
Data = [kz_csv:mapped_row_to_iolist(Header, Stripped), $\n],
Data = kz_csv:mapped_row_to_iolist(Header, Stripped),
'ok' = file:write_file(OutputPath, Data, ['append']),
strip_columns(FullHeader, Header, NewCSV, OutputPath)
end.
Expand Down
4 changes: 2 additions & 2 deletions applications/tasks/src/modules/kt_task_worker.erl
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ write_row(TaskId, Header, MappedRow) ->

-spec write_row(kz_tasks:id(), iodata()) -> 1.
write_row(TaskId, IOList) ->
kz_util:write_file(?OUT(TaskId), [IOList,$\n], ['append']),
kz_util:write_file(?OUT(TaskId), IOList, ['append']),
1.

-spec columns(kz_csv:mapped_row()) -> kz_tasks:columns().
Expand All @@ -297,7 +297,7 @@ reason(_) -> <<>>.
write_output_csv_header(TaskId, {'replace', Header}) ->
write_output_csv_header(TaskId, Header);
write_output_csv_header(TaskId, Header) ->
Data = [kz_csv:row_to_iolist(Header), $\n],
Data = kz_csv:row_to_iolist(Header),
file:write_file(?OUT(TaskId), Data).

-spec output_csv_header(kz_json:object(), kz_csv:row()) -> kz_tasks:output_header().
Expand Down

0 comments on commit 73a6ee0

Please sign in to comment.