iFlameing's Blog

Weekly CheckIN 8th

iFlameing
Published: 07/28/2019

What did you do this week?

Hoorya!! I passed the second evaluation. In the evaluation week I mainly completed the only test which is left before the second evaluation i.e Adding test for the ploneGenerator method which generate all the Gatsby Node initially.  It is the most important generator function. I never tested the generator function in my life. I searched what is the best way to test the generator function and I found some response and successfully Send a pr for that. After that there is simple bug i.e Foreach array method randomly calling the api but we need syncrounus behaviour. After devoting one day and lot of thinking I found that only replacing the foreach method with for loop does the trick. Then I successfully created the pr for that also. You can see the pr link below.

https://github.com/collective/gatsby-source-plone/pull/218 

https://github.com/collective/gatsby-source-plone/pull/225

 

What is coming up next?

Upto this time I have successfully implemented the MVP for my project. Written test for all the function which is present in the source code. Now, I only have to refactor the code and write documentation for the added feature. So, You can think that this period mainly deal with refactoring and documenting.

Did you get stuck anywhere?

Really for first time in this project I suffer with simple issue which is converting the foreach method to for loop. It was not easy to find what's going wrong with foreach. Why it doesn't behaviour synchronously. But after lot of thinking and experiment I am able to attend the behaviour i.e synchronous.

 

View Blog Post

weekly CheckIn 7th

iFlameing
Published: 07/21/2019

What did you do this week?

I have completed MVP in starting week of 2nd Phase, I moved on writing test for the added feature. I have to read lot's of documentation of jest and Plone CMS API for writing test and setting mock up data. I have written test for may function which is used for creating Gatsby Node from fetching data from Plone CMS. I also remove some redundant code which is not used more in gatsby-node.js file. You can see my pull request by visiting below link.

https://github.com/collective/gatsby-source-plone/pull/200

https://github.com/collective/gatsby-source-plone/pull/201

https://github.com/collective/gatsby-source-plone/pull/204

https://github.com/collective/gatsby-source-plone/pull/208

https://github.com/collective/gatsby-source-plone/pull/214

What is coming up next?

One or more test Which is left in the code base. After that every line is tested and all code is cover with test.  The test for breadcrumbs node is left and is completed in next one or two days :)

Did you get stuck anywhere?

Writing test for async code and setting the mock behaviour of fetching data is a tedious task. I have to manipulate some function to pass the test. It is most intense task which I have done in my gsoc period. But after reading the documentation of jest and some googling I am able to write the test. Other than this I am having a great time :)

If you find anything interesting please comment. I love to hear some feedback !!! :)

 

View Blog Post

Weekly CheckIn 6th

iFlameing
Published: 07/14/2019

What did you do this week?

In this week I started writing the test for the gatsby-node API. I read lot's of documentation regarding jest because our previous test is written using this framework. I also do some research regarding the unit test and converting our whole source code into typescript. But we came to the conclusion that first, we write a unit test for all the function and if time permits we devote our entire time working rewriting whole source plugin. I have written a test for makecontentNode function which converts the fetched content into Gatsby Node.  You can see the pr below 

https://github.com/collective/gatsby-source-plone/pull/200

What is coming up next?

I will try to test all the code which is written in gatsby-node.js. so, we can accept more test to come in next week.

 

Did you get stuck anywhere?

I faced some difficulty regarding setting up mock data for the test but fetching up some Plone CMS API I am able to gather the test data. Other than that I am having a good time :)

 

View Blog Post

3rd Blog Post After First Evaluation

iFlameing
Published: 07/08/2019

I successfully passed the first evaluation, Hooray! So after first evaluation I started working on issue related to the permission based update of node. After the addition of create, modified and delete feature I encounter with another problem now I have to handle the node based on permission. Plone CMS provide the feature of making field public or private. If the field is public then we have to create the node otherwise we don't. When a field is changed from private to public we get a websocket event modified and I have to handle this case into modified case. For handling this issue I have to change the logic of modified event and I am able to do it after some hard work. Then I started working on updating the Plone Collection after a long silence from the Plone CMS. It is done because we don't have currently any feature that we can detect whether a Plone collection is changed or not. After learning how polling is done I implemented it successfully. I learned how we can use SetTimeout and how we can reset it. After reading the documentation on MDN and helped from my mentor I successfully Imlemented it. Now I am working on test for the added feature of previous month.

 

Auto Updating Plone Collections

https://github.com/collective/gatsby-source-plone/pull/194

Removing and creating field based on Permission

https://github.com/collective/gatsby-source-plone/pull/192

Thanks for reading! I am happy to hear any feedback :)

View Blog Post

2nd Blog Post

iFlameing
Published: 07/06/2019

sorry, For the late post. But in this Post I am going to explain what I had done between 10th June to 24th June 2019.  I started from where I left, I added the update functionality but using my own function which is causing redundancy in code base. I developed a strong concept of javascript generator function. After having generator concept understanding gatsby-source-plone code base become very easy. I refactored my code and use the existing generator function for creating the node. During these period I think I read every page of gatsby docs, each and every method it provide and how we can use it. It is very hard task to read all the api exposed by gatsby and remember them and use them whenever it needed. I have to read API details each day but I feel myself lucky because I have a strong understanding how Gatsby works inside.

After the implementation of update now I moved towards updating the modified node. Whenever a node is modified in Plone CMS I received a websocket events containing the modified node id and its parent id. I have to recreate the modified node and its parent node. It is a lot of task. But I have implemented it just in a week. I work almost 8 to 9 hours per day to complete this feature.

Adding the modified feature I feel very relaxed and self motivated because I have completed 2 milestone in 2 weeks which is a big win for me. Then I started with my third milestone that is handing the delete node. I had to remove the node which is deleted in Plone CMS. I received the similar websocket event as above a node id which is deleted and it parent Id. I also implement this feature in a week. But this time I struggle a most because I encounter a error which I didn't understand why it is happening. The error is related to deleting the folder. Deleting folder gives me continuous websocket event for its child. when I am trying the fetch the parents of child, It is already deleted from the Plone CMS. I got an error, after talking to mentor I figured out Implementing try catch block and changing some logic. At this time the first evaluation started I am hoping to get passed it easily :)

Thanks for reading if you find anything interesting please! comment. Happy to hear your feedback :) 

View Blog Post