WSC-Nettie-Owners / wscnettie

https://www.wscnettie.com
2 stars 0 forks source link

Complete Excel Uploads for Questions in Admin View #28

Open Nottommy11 opened 11 months ago

Nottommy11 commented 11 months ago

There is currently a lot of code out there for this task. It is located in the src/routes/profile/[profileid]/Functions directory.

Currently, it starts in the Admin.svelte page. There is a file upload input that allows the user to upload an Excel file. This calls the uploadExcel function passing the current questions that are filtered and sorted. This is all working fine.

What needs adjusting is the process in which the upload is converted to an array of objects that contain new questions, questions to be updated/changed, new answers, answers to be updated/changed, new correct answers, correct answers to be updated/changed, new incorrect answers, and incorrect answers to be updated/changed.

I set it up to check if there is an ID associated with the item and if so, then it is an update/change. If there is no ID, then it's a new item. That system should work, assuming the items are changed/added properly.

Then the related items need to be inserted or updated in the database via a Graphql call to Hasura.

If you think there's a better process for this or a better idea related to this Issue, just add comments below. If you have any questions, feel free to ask me individually or @ me in a comment.

Make sure to use the Dev version of Hasura in your .env file, and make sure not to touch live data. If you need help, comment below.

The login for Admin View can be found in Hasura -> Data Tab -> net_users schema -> logins table.