Create ocflib Tools for Announcements
https://github.com/ocf/api/issues/49
@ben9583 Hi Ben. Can you take a look and make sure the function behaviors are good? I will implement cache and make the code more efficient later.
As for why the tests are failing, one of them is a regular housekeeping task (don't worry about it), and the other two are... from my code from 2 years ago. I'll take a look at why they're failing now.
Ok I'm blaming the issues with mine on daylight savings happening that day. There only seems to be one commit in which it fails and that doesn't include the most recent one
Ok is there anything I need to do to fix the checks?
Will take a more thorough look at this tomorrow, but it seems the tests on Jenkins are not working properly since the recent changes
This is looking pretty much all good, just a couple notes
- The post IDs should be cached too (in addition to the text which you've done), so that way we don't have to call the GitHub API to scan all of the announcements so often
- There should be
get_last_n_announcementsthat just returns the IDs and metadata (using caching), we don't need to get all the lastnannouncement full text contents
Let me know if you have questions of what I mean by this cause I may have worded this a bit weird. I can explain more on specifics
I have changed the structure a little. The script now checks for updated cache whenever get_last_n_announcements and get_last_n_announcements_text are called, so the cache checking behavior is more consistent.
I have also updated the README so people would know how to test individual test file.
Let me know if you have any thoughts! The script should be good to go. I haven't added the tests for the cache since I have not yet thought of a good way to test it. It might make more sense to actually call it from the front end to make sure its behavior is good. But it is not super complex so we don't necessarily need super complex tests.