This is an automated email from the ASF dual-hosted git repository. sebb pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push: new 0412cc7f Fix calculation for past meetings 0412cc7f is described below commit 0412cc7fde39b10c54ebbec5207b2f0e86a54afd Author: Sebb <s...@apache.org> AuthorDate: Fri Apr 12 17:46:10 2024 +0100 Fix calculation for past meetings --- lib/whimsy/asf/meeting-util.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/whimsy/asf/meeting-util.rb b/lib/whimsy/asf/meeting-util.rb index b6511de6..307fa08a 100644 --- a/lib/whimsy/asf/meeting-util.rb +++ b/lib/whimsy/asf/meeting-util.rb @@ -433,11 +433,13 @@ module ASF # How long remains before applications close? # (Time is measured from scheduled end of the meeting in which the votes were declared) # Returned as hash, e.g. {:hoursremain=>605, :days=>25, :hours=>5} + # If applications have expired, :hoursremain is negative + # and :days/:hours are elapsed time since expiry def self.application_time_remaining meetingend = self.meeting_end # this is in seconds now = DateTime.now.to_time.to_i remain = (meetingend + APPLICATION_EXPIRY_POST_VOTE_SECS - now) / 3600 - {hoursremain: remain, days: remain/24, hours: remain%24} + {hoursremain: remain, days: remain.abs/24, hours: remain.abs%24} end # Are membership applications still valid?