From b6ee08c2fb5ba808fe152af973b529840097113e Mon Sep 17 00:00:00 2001 From: neodarz Date: Thu, 9 Feb 2017 14:25:20 +0100 Subject: Fix a little bug to set the correct id when the file it's uploaded --- web/controllers/audio_file_controller.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web') diff --git a/web/controllers/audio_file_controller.ex b/web/controllers/audio_file_controller.ex index ef9d46c..c4e1af0 100644 --- a/web/controllers/audio_file_controller.ex +++ b/web/controllers/audio_file_controller.ex @@ -19,7 +19,7 @@ defmodule TheTranscriberBackend.AudioFileController do result = Ecto.Adapters.SQL.query!(Repo, query, []) [[repo_last_id]] = result.rows # A beautiful pattern match :) - path = "/media/phoenix_test/#{repo_last_id}_#{upload.filename}" + path = "/media/phoenix_test/#{repo_last_id + 1}_#{upload.filename}" File.cp(upload.path, path) changeset = AudioFile.changeset(%AudioFile{}, -- cgit v1.2.1