noosfero | Use chartkick gem to improve the visualization of custom_form submissions. (!1316)

Rodrigo Souto gitlab at mg.gitlab.com
Thu Sep 28 10:00:50 BRT 2017


Rodrigo Souto started a new discussion on plugins/custom_forms/lib/custom_forms_plugin/form.rb:

>      self.article = uploaded_file
>    end
>  
> +  def duration_in_days
> +    if begining == nil and ending == nil
> +      return "Has no ending date."
> +    end
> +    seconds_to_days = 86400
> +    days = (ending.to_i - begining.to_i) / seconds_to_days

With the previous test you made `if begining == nil and ending == nil` you might still end up here in cases where only the begining or only the ending is `nil`. In this cases they will return zero and will mess your answers.

I don't know yet where you are using this code but it looks like something I made on another branch. Take a look a the method `time_status` I implemented on the following code and check if it solves your problem too: https://gitlab.com/diguliu/noosfero/blob/all-queries/plugins/custom_forms/lib/custom_forms_plugin/helper.rb

---
Reply to this email directly or view it on GitLab: https://gitlab.com/noosfero/noosfero/merge_requests/1316#note_41776299
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20170928/0f2c3833/attachment.html>


More information about the Noosfero-dev mailing list