2016年10月23日星期日

Week12 Finishing back end

In this week, I start finishing last part of back end which is get some additional information from Trove and add them into data base. The additional information is about some mete data of art work images, include contributor, issued date, title and Trove URL (link to the Trove website, rather than source of the image). All these data are come from Trove though Trove API.

In order to transfer additional data to the database, I create four columns for each image, called contributor, issued, title and troveUrl, I also crate eight new variables to store these values which from the Trove data. Then I added same code to the refresh functions, because after each refresh, the image should change by follow the image ID.

Additional information

new variables for each additional data 
However, there is a problem that I can’t get additional information after click refresh button to change images, the problem occur is because the Trove data haven’t defined within refresh function, because it’s out of the getJSON function. So the solution is move two refresh functions into getJSON function, then the value can be defined and changed after click refresh button.


Move refresh functions into getJSON function
I noticed that not all of images have these mete data, for example some images don’t have contributor, this is one of the limitation of using Trove API, because we can only use the data that provided by Trove, otherwise we can’t do anything with it. So I change the database that allow contributor, issued, and title to be Null value. 




没有评论:

发表评论