base setup for mangadex import; handling base cases#550
Conversation
| RSpec.describe MangadexImport::Row do | ||
| let(:mangadex_data_regular) { JSON.parse(fixture('mangadex_import/manga-batch-1-temp.ndjson')) } | ||
| let(:mangadex_data_hentai) { JSON.parse(fixture('mangadex_import/mangadex-hentai.ndjson')) } | ||
| # let(:kitsu_data) { JSON.parse(fixture('mangadex_import/kitsu_data/kyou-wa-kaisha-yasumimasu.json')) } |
There was a problem hiding this comment.
Line is too long. [105/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
| return if mangadex_data['chapters'].blank? | ||
|
|
||
| mangadex_data['chapters'].each do |mangadex_chapter| | ||
| kitsu_chapter = kitsu_data.chapters.where(number: mangadex_chapter['chapter']).first_or_initialize |
There was a problem hiding this comment.
Line is too long. [106/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
|
|
||
| mangadex_data['chapters'].each do |mangadex_chapter| | ||
| kitsu_chapter = kitsu_data.chapters.where(number: mangadex_chapter['chapter']).first_or_initialize | ||
| kitsu_chapter.volume_number ||= mangadex_chapter['volume'] |
There was a problem hiding this comment.
@NuckChorris Are we getting rid of volume_number and just going to be using the Volume association? Should I just find or create a new volume based on the chapter?
| @@ -0,0 +1,34 @@ | |||
| class MangadexImport | |||
| class Chapter1 | |||
There was a problem hiding this comment.
@NuckChorris I am having naming conflicts with ActiveRecord Chapter. Unsure how to fix
| # NOTE: I don't think this works the way I intended. | ||
| # I was thinking that we can just do save at the end and it will save | ||
| # the associations. | ||
| @kitsu_data.categories << category |
There was a problem hiding this comment.
This saves right away is what I realized
| 'hungarian' => 'hu', | ||
| 'indonesian' => 'id_in', | ||
| 'italian' => 'it', | ||
| 'japanese' => 'en_jp', |
| 'catalan' => 'ca', | ||
| 'chinese (trad)' => 'zh_Hant', | ||
| 'chinese (simp)' => 'zh_Hans', | ||
| 'english' => 'en', |
There was a problem hiding this comment.
should this also be en_jp because when saving with Chapter it will fail validation...
What
This feature will import all the data we scraped from mangadex and update our database.
This has the potential to update or create:
Why
Still in the process, but the general idea is to copy what we did for the tvdb scheduled job import.
Checklist