Plots2: Need to update the revision timestamp when publishing drafts

Created on 19 Mar 2019  路  4Comments  路  Source: publiclab/plots2

This has been marked as a good candidate for becoming a first-timers-only issue like these, meaning that it's simple, self-contained, and with some extra formatting, could be a great entry point for a new contributor. If you're familiar enough with this code, please consider reformatting or reposting it as a first-timers-only issue, and then ping @publiclab/reviewers to get it labelled. Or, if this is not your first time, try to solve it yourself!


I just published from a draft here: https://publiclab.org/notes/warren/03-19-2019/assembling-the-simple-air-sensor and it correctly updated the timestamp to "now" when i published, as you can see in the URL.

But on the dashboard it shows up as "4 days ago" so I think we are not updating the revision timestamp as well...

Here's the code:

https://github.com/publiclab/plots2/blob/4fc2e9f0d54485dbfebb0d3ab070d9d2ce9497c7/app/controllers/notes_controller.rb#L381-L394

I think we need to add a line to update the @node.latest (i.e. the most recent revision) timestamp to Time.now like:

revision = @node.latest
revision.timestamp = Time.now.to_i
revision.save

Thank you!!!

Ruby bug fto-candidate help wanted

Most helpful comment

@jywarren I want to work on this.

All 4 comments

@jywarren I want to work on this.

Go ahead @jainaman224!

@jywarren
Url is updated due to https://github.com/publiclab/plots2/blob/master/app/models/node.rb#L140 use of Time.now but we are using node.created_at as publish time. Which can't be changed.
In Node model there is no publish time. So, how should I approach it?

Addressing this in #6913!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

first-timers[bot] picture first-timers[bot]  路  3Comments

grvsachdeva picture grvsachdeva  路  3Comments

ebarry picture ebarry  路  3Comments

keshavsethi picture keshavsethi  路  3Comments

grvsachdeva picture grvsachdeva  路  3Comments