ocflib icon indicating copy to clipboard operation
ocflib copied to clipboard

Create ocflib Tools for Announcements

Open vicshi06 opened this issue 2 years ago • 7 comments

https://github.com/ocf/api/issues/49

vicshi06 avatar Oct 31 '23 06:10 vicshi06

@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.

vicshi06 avatar Nov 05 '23 19:11 vicshi06

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.

ben9583 avatar Nov 09 '23 02:11 ben9583

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

ben9583 avatar Nov 09 '23 02:11 ben9583

Ok is there anything I need to do to fix the checks?

vicshi06 avatar Nov 11 '23 21:11 vicshi06

Will take a more thorough look at this tomorrow, but it seems the tests on Jenkins are not working properly since the recent changes

ben9583 avatar Nov 13 '23 07:11 ben9583

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_announcements that just returns the IDs and metadata (using caching), we don't need to get all the last n announcement 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

ben9583 avatar Dec 08 '23 04:12 ben9583

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.

vicshi06 avatar Dec 12 '23 23:12 vicshi06