Open
Conversation
spajic
approved these changes
May 22, 2019
Owner
spajic
left a comment
There was a problem hiding this comment.
Хорошая, интересная работа!
Попробуйте теперь bonus-task-2 в развитие этой темы
| end | ||
|
|
||
| def import_cities | ||
| cities = Set.new |
Owner
There was a problem hiding this comment.
Интересная идея с Set!
По-моему первый раз встречается среди домашних работ этого задания.
| @@ -1,16 +1,7 @@ | |||
| <h1> | |||
| <%= "Автобусы #{@from.name} – #{@to.name}" %> | |||
| <%= "Автобусы #{params[:from]} – #{params[:to]}" %> | |||
| </ul> | ||
| <%= render "delimiter" %> | ||
| <% end %> | ||
| <%= render partial: 'trip', collection: @trips, spacer_template: "delimiter", cached: true %> |
|
|
||
| ### Загрузка данных в базу | ||
| ## Находка №1 | ||
| Для обработки каждой json записи инициализируется несколько объектов и каждый из них в отдельной транзакции вставляется в базу данных, что крайне неэффективно на больших объемах. Было принято решение использовать ```gem activerecord-import```, для массовой вставки данных |
| Для обработки каждой json записи инициализируется несколько объектов и каждый из них в отдельной транзакции вставляется в базу данных, что крайне неэффективно на больших объемах. Было принято решение использовать ```gem activerecord-import```, для массовой вставки данных | ||
|
|
||
| ## Находка №2 | ||
| Используется устаревший метод ```has_and_belongs_to_many```. Использовав связную модель через ```has many through:```, появляется возможность более эффективно использовать ```gem activerecord import``` |
| Используется устаревший метод ```has_and_belongs_to_many```. Использовав связную модель через ```has many through:```, появляется возможность более эффективно использовать ```gem activerecord import``` | ||
|
|
||
| ## Находка №3 | ||
| Используется не самая эффективная библиотека для работы с json. Было принято решение использовать ```gem oj```, для более эффективной обработки |
Owner
There was a problem hiding this comment.
👍 Тут бы хорошо добавить инф-ю про эффект замены
| disable_ddl_transaction! | ||
|
|
||
| def change | ||
| add_index :trips, [:from_id, :to_id], algorithm: :concurrently |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.