From e4771aa2268c3648296499d76754e342c9523daf Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Sat, 18 Feb 2023 18:14:42 +0400 Subject: [PATCH] Order and numerate --- main.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.rb b/main.rb index d36b2c3..40c86e3 100755 --- a/main.rb +++ b/main.rb @@ -134,13 +134,15 @@ public word_id = $1 AND translation_texts.lang_id = $2 + ORDER BY translations.index ASC SQL ), [word_id, user_lang_id], ).to_a - values.map do |row| + values.map.with_index do |row, index| { + index: index + 1, translation: String(row['value']).strip.freeze, commentary: String(row['commentary']).strip.freeze, }.freeze