-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base setup for mangadex import; handling base cases #550
base: the-future
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [106/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
lib/mangadex_import/row.rb
Outdated
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This saves right away is what I realized
'hungarian' => 'hu', | ||
'indonesian' => 'id_in', | ||
'italian' => 'it', | ||
'japanese' => 'en_jp', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct?
'catalan' => 'ca', | ||
'chinese (trad)' => 'zh_Hant', | ||
'chinese (simp)' => 'zh_Hans', | ||
'english' => 'en', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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