You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@whimsical.apache.org by sebb <se...@gmail.com> on 2017/06/11 11:36:20 UTC
Re: [whimsy] branch master updated: WHIMSY-98 - Properly display duration.
On 10 June 2017 at 16:02, <jo...@apache.org> wrote:
> This is an automated email from the ASF dual-hosted git repository.
>
> johndament 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 4e7bfd5 WHIMSY-98 - Properly display duration.
> 4e7bfd5 is described below
>
> commit 4e7bfd55a224d608d8d0ed448f910cbd77d36f19
> Author: John D. Ament <jo...@apache.org>
> AuthorDate: Sat Jun 10 11:02:26 2017 -0400
>
> WHIMSY-98 - Properly display duration.
> ---
> lib/whimsy/asf/podlings.rb | 12 ++++++++----
> www/roster/models/ppmc.rb | 1 +
> www/roster/views/ppmc/main.js.rb | 1 +
> 3 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/lib/whimsy/asf/podlings.rb b/lib/whimsy/asf/podlings.rb
> index 922aa20..9674293 100644
> --- a/lib/whimsy/asf/podlings.rb
> +++ b/lib/whimsy/asf/podlings.rb
> @@ -77,6 +77,13 @@ module ASF
> nil
> end
>
> + def duration
> + enddate = Date.today
> + enddate = Date.parse(@enddate) if @enddate
> +
> + (enddate - Date.parse(@startdate)).to_i
> + end
> +
> # lazy evaluation of reporting
> def reporting
> if @reporting.instance_of? Nokogiri::XML::Element
> @@ -269,10 +276,7 @@ module ASF
> hash[:resourceAliases] = resourceAliases
> hash[:namesearch] = namesearch if namesearch
> hash[:sponsor] = @sponsor if @sponsor
> - enddate = Date.today
> - enddate = Date.parse(@enddate) if @enddate
> -
> - hash[:duration] = (enddate - Date.parse(@startdate)).to_i
> + hash[:duration] = self.duration
I don't think it's a good idea to include duration in the json output.
It means the json file will change every day.
The calculation should be done on display instead.
> hash[:podlingStatus] = podlingStatus
> hash
> end
> diff --git a/www/roster/models/ppmc.rb b/www/roster/models/ppmc.rb
> index 0a8d3cb..18ba2b9 100644
> --- a/www/roster/models/ppmc.rb
> +++ b/www/roster/models/ppmc.rb
> @@ -62,6 +62,7 @@ class PPMC
> roster: roster,
> mail: Hash[lists.sort],
> moderators: moderators,
> + duration: ppmc.duration,
> podlingStatus: statusInfo,
> namesearch: ppmc.namesearch,
> }
> diff --git a/www/roster/views/ppmc/main.js.rb b/www/roster/views/ppmc/main.js.rb
> index 4a96c8e..51a06b5 100644
> --- a/www/roster/views/ppmc/main.js.rb
> +++ b/www/roster/views/ppmc/main.js.rb
> @@ -119,6 +119,7 @@ class PPMC < React
> # reporting schedule
> _h3.reporting! 'Reporting Schedule'
> _ul do
> + _li "Incubating for "+@ppmc.duration+" days"
> _li @ppmc.schedule.join(', ')
> _li "Monthly: #{@ppmc.monthly.join (', ')}" if @ppmc.monthly and !@ppmc.monthly.empty?
> _li do
>
> --
> To stop receiving notification emails like this one, please contact
> ['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].
Re: [whimsy] branch master updated: WHIMSY-98 - Properly display duration.
Posted by "John D. Ament" <jo...@apache.org>.
Yep, you're right. It doesn't need to be in the json hash as long as the
business logic can read it for that function.
On Sun, Jun 11, 2017 at 7:40 AM sebb <se...@gmail.com> wrote:
> On 11 June 2017 at 12:36, sebb <se...@gmail.com> wrote:
> > On 10 June 2017 at 16:02, <jo...@apache.org> wrote:
> >> This is an automated email from the ASF dual-hosted git repository.
> >>
> >> johndament 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 4e7bfd5 WHIMSY-98 - Properly display duration.
> >> 4e7bfd5 is described below
> >>
> >> commit 4e7bfd55a224d608d8d0ed448f910cbd77d36f19
> >> Author: John D. Ament <jo...@apache.org>
> >> AuthorDate: Sat Jun 10 11:02:26 2017 -0400
> >>
> >> WHIMSY-98 - Properly display duration.
> >> ---
> >> lib/whimsy/asf/podlings.rb | 12 ++++++++----
> >> www/roster/models/ppmc.rb | 1 +
> >> www/roster/views/ppmc/main.js.rb | 1 +
> >> 3 files changed, 10 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/lib/whimsy/asf/podlings.rb b/lib/whimsy/asf/podlings.rb
> >> index 922aa20..9674293 100644
> >> --- a/lib/whimsy/asf/podlings.rb
> >> +++ b/lib/whimsy/asf/podlings.rb
> >> @@ -77,6 +77,13 @@ module ASF
> >> nil
> >> end
> >>
> >> + def duration
> >> + enddate = Date.today
> >> + enddate = Date.parse(@enddate) if @enddate
> >> +
> >> + (enddate - Date.parse(@startdate)).to_i
> >> + end
> >> +
> >> # lazy evaluation of reporting
> >> def reporting
> >> if @reporting.instance_of? Nokogiri::XML::Element
> >> @@ -269,10 +276,7 @@ module ASF
> >> hash[:resourceAliases] = resourceAliases
> >> hash[:namesearch] = namesearch if namesearch
> >> hash[:sponsor] = @sponsor if @sponsor
> >> - enddate = Date.today
> >> - enddate = Date.parse(@enddate) if @enddate
> >> -
> >> - hash[:duration] = (enddate - Date.parse(@startdate)).to_i
> >> + hash[:duration] = self.duration
> >
> > I don't think it's a good idea to include duration in the json output.
> >
> > It means the json file will change every day.
> >
> > The calculation should be done on display instead.
>
> It occurs to me that the code that creates the json can just drop the
> attribute.
>
> >> hash[:podlingStatus] = podlingStatus
> >> hash
> >> end
> >> diff --git a/www/roster/models/ppmc.rb b/www/roster/models/ppmc.rb
> >> index 0a8d3cb..18ba2b9 100644
> >> --- a/www/roster/models/ppmc.rb
> >> +++ b/www/roster/models/ppmc.rb
> >> @@ -62,6 +62,7 @@ class PPMC
> >> roster: roster,
> >> mail: Hash[lists.sort],
> >> moderators: moderators,
> >> + duration: ppmc.duration,
> >> podlingStatus: statusInfo,
> >> namesearch: ppmc.namesearch,
> >> }
> >> diff --git a/www/roster/views/ppmc/main.js.rb
> b/www/roster/views/ppmc/main.js.rb
> >> index 4a96c8e..51a06b5 100644
> >> --- a/www/roster/views/ppmc/main.js.rb
> >> +++ b/www/roster/views/ppmc/main.js.rb
> >> @@ -119,6 +119,7 @@ class PPMC < React
> >> # reporting schedule
> >> _h3.reporting! 'Reporting Schedule'
> >> _ul do
> >> + _li "Incubating for "+@ppmc.duration+" days"
> >> _li @ppmc.schedule.join(', ')
> >> _li "Monthly: #{@ppmc.monthly.join (', ')}" if @ppmc.monthly and
> !@ppmc.monthly.empty?
> >> _li do
> >>
> >> --
> >> To stop receiving notification emails like this one, please contact
> >> ['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].
>
Re: [whimsy] branch master updated: WHIMSY-98 - Properly display duration.
Posted by sebb <se...@gmail.com>.
On 11 June 2017 at 12:36, sebb <se...@gmail.com> wrote:
> On 10 June 2017 at 16:02, <jo...@apache.org> wrote:
>> This is an automated email from the ASF dual-hosted git repository.
>>
>> johndament 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 4e7bfd5 WHIMSY-98 - Properly display duration.
>> 4e7bfd5 is described below
>>
>> commit 4e7bfd55a224d608d8d0ed448f910cbd77d36f19
>> Author: John D. Ament <jo...@apache.org>
>> AuthorDate: Sat Jun 10 11:02:26 2017 -0400
>>
>> WHIMSY-98 - Properly display duration.
>> ---
>> lib/whimsy/asf/podlings.rb | 12 ++++++++----
>> www/roster/models/ppmc.rb | 1 +
>> www/roster/views/ppmc/main.js.rb | 1 +
>> 3 files changed, 10 insertions(+), 4 deletions(-)
>>
>> diff --git a/lib/whimsy/asf/podlings.rb b/lib/whimsy/asf/podlings.rb
>> index 922aa20..9674293 100644
>> --- a/lib/whimsy/asf/podlings.rb
>> +++ b/lib/whimsy/asf/podlings.rb
>> @@ -77,6 +77,13 @@ module ASF
>> nil
>> end
>>
>> + def duration
>> + enddate = Date.today
>> + enddate = Date.parse(@enddate) if @enddate
>> +
>> + (enddate - Date.parse(@startdate)).to_i
>> + end
>> +
>> # lazy evaluation of reporting
>> def reporting
>> if @reporting.instance_of? Nokogiri::XML::Element
>> @@ -269,10 +276,7 @@ module ASF
>> hash[:resourceAliases] = resourceAliases
>> hash[:namesearch] = namesearch if namesearch
>> hash[:sponsor] = @sponsor if @sponsor
>> - enddate = Date.today
>> - enddate = Date.parse(@enddate) if @enddate
>> -
>> - hash[:duration] = (enddate - Date.parse(@startdate)).to_i
>> + hash[:duration] = self.duration
>
> I don't think it's a good idea to include duration in the json output.
>
> It means the json file will change every day.
>
> The calculation should be done on display instead.
It occurs to me that the code that creates the json can just drop the attribute.
>> hash[:podlingStatus] = podlingStatus
>> hash
>> end
>> diff --git a/www/roster/models/ppmc.rb b/www/roster/models/ppmc.rb
>> index 0a8d3cb..18ba2b9 100644
>> --- a/www/roster/models/ppmc.rb
>> +++ b/www/roster/models/ppmc.rb
>> @@ -62,6 +62,7 @@ class PPMC
>> roster: roster,
>> mail: Hash[lists.sort],
>> moderators: moderators,
>> + duration: ppmc.duration,
>> podlingStatus: statusInfo,
>> namesearch: ppmc.namesearch,
>> }
>> diff --git a/www/roster/views/ppmc/main.js.rb b/www/roster/views/ppmc/main.js.rb
>> index 4a96c8e..51a06b5 100644
>> --- a/www/roster/views/ppmc/main.js.rb
>> +++ b/www/roster/views/ppmc/main.js.rb
>> @@ -119,6 +119,7 @@ class PPMC < React
>> # reporting schedule
>> _h3.reporting! 'Reporting Schedule'
>> _ul do
>> + _li "Incubating for "+@ppmc.duration+" days"
>> _li @ppmc.schedule.join(', ')
>> _li "Monthly: #{@ppmc.monthly.join (', ')}" if @ppmc.monthly and !@ppmc.monthly.empty?
>> _li do
>>
>> --
>> To stop receiving notification emails like this one, please contact
>> ['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].