Application every day has up to 100 attempts to get the photo that was not previously seen here.
There are a few steps to achieve that.
First of all, there is one random word selected from quite large word list - some are related to what NASA does, some are completely random.
Selected word is sent to NASA API to return all photos related to this word. NASA API returns list up to 100 images. If there are no photos - process starts from the beginning.
From this list the application needs to select one random picture. It selects random number that is used to select a photo.
Information about selected photo is stored in the database and this data is used to publish post on Facebook and display photo here!
If anything goes wrong an exception is raised.
Table is representation of the work that was done to get this photo. Each column represents one step of the process:
- Attemp # - number of the attempt, possibly from one to one hundred, most of the time first attempt is successful.
- Selected Word - random word that was selected and sent to NASA API.
- Photos Found - count of the photos found by NASA API - up to one hundred.
- Selected Photo - represents which photo from the list was selected - in this table list is indexed from one.
- Exception? - Yes/No - if exception happened than is says Yes, otherwise No.