vidhiya-saagar / spg2

🌕 Suraj Prakash Granth - Rails 7 Admin Application.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create method that can import the CSVs

dsomel21 opened this issue · comments

Description

As mentioned in #3, some of the content of the Suraj Prakash granth lives inside of Excel spreadsheets.

It's formatted like this, for the most part:

Screen Shot 2023-04-08 at 4 21 54 PM

Objective

We need to create some kind of method that can the CSV of a chapter and import it into the database.

Things to Consider

  • When you create a record, it will automatically be assigned an unique auto-incremented id...
  • If you delete that record, you can't really use that id again
  • Meaning, we should think strongly about this... You don't want to create a chapter, and then have that id change... This will be bad because if someone shares a link to /chapter/123 and that link now references a different chapter.

@anhadpreetsingh, @bhinder97 this is pretty much going to be the method that imports chapters.

For example, if we want to import Chapter 1, of Book 1, we download the CSV that we have... and then use some method to create the Chapter, ChhandType (if it doesn't exist yet), Chhand and then insert the Pauri, and Tuks and stuff.

Since we have the Bhai Vir Singh footnotes from the PDFs as well, we can add those, too!