< 172021-09-18⋎19 >

Topic for #farmOS is: farmOS (farmos.org) is a free and open source, web-based farm management system. User guide: farmos.org/guide/ - Forum: farmOS.discourse.groupSet by mstenta on 2021-06-15 at 12:52
01:15symbioquine[m]paul121 & jgaehring I tested that archive timestamp behavior... it looks like a bug to me;... (full message at libera.ems.host/_matrix/media/r0/downloa)
01:15symbioquine[m]Thoughts?
01:18symbioquine[m]Context for anyone else who wants to follow along: an offline client like FieldKit should presumably be able to record that an asset has been archived and have the archived date be the time that the action was taken, not the time the action was synced back to farmOS. The commands above create a new animal and attempt to archive it with a historical archive date.
01:47paul121[m]Haha `jq` is so cool :D
01:49paul121[m]But yeah, this makes sense that it updates the archived correctly when you send the request twice. That's due to the `AssetStorage::preSave` logic - IIRC it was checks for a state change from `active -> archived`, and in that case, it updates the archive timestamp
01:50paul121[m]s/was//
01:52paul121[m]The state change only happens the first time that request is sent
01:55paul121[m]Maybe we just need to check if the `archived` attribute changed between the `$old` and `$new` versions of the entity in the `::preSave` method? If it changed, then that means a new archived timestamp was specified, and should be used instead?
01:55paul121[m](going off memory on some of this)
05:33symbioquine[m]Thanks for the tip! That seems to be it...
05:33symbioquine[m]This seemed to fix it;... (full message at libera.ems.host/_matrix/media/r0/downloa)
05:34symbioquine[m]I'll need to test a bit more thoroughly in the morning, but I'll probably send a PR then. :)
05:41paul121[m]That would be a simple fix!
13:44symbioquine[m]<paul121[m]> "That would be a simple fix!" <- Yeah, I think it's going to work :)
13:53mstenta[m]Cool! Good sleuthing symbioquine !
13:53mstenta[m]Fix makes sense!
13:54symbioquine[m]Thanks!
13:54mstenta[m]One thought: do we set archived to null if it gets unarchived?
13:54mstenta[m]If not, then that might not be null
13:54symbioquine[m]Yeah, I'm curious about what should happen in those cases too...
13:55symbioquine[m]i.e. setting the archived date to a non-null value while the asset is still active
13:55mstenta[m]I forget if we handle that in pho
13:55mstenta[m]PHP*
13:55symbioquine[m]and setting the archived date to null when the asset is archived
13:55symbioquine[m]I suspect that should trigger the state changes...
13:55symbioquine[m]Otherwise it leaves the asset in an inconsistent state.
13:56symbioquine[m]However, it gets more complex if the intention was to support additional asset states via contrib modules.
15:21paul121[m]One approach could be to add an entity validation condition that ensures the state and archived fields are correct
15:23paul121[m]If you tried to update the archived timestamp while it is active, it would return an error via JSONAPI
16:25symbioquine[m]mstenta: Do you know of any use-cases where a contrib module would want to define additional asset states beyond active/archived? If not, my inclination would be to code the archived date logic based on that assumption and wait for such a use-case to arise...
16:40botlfarm[m]Quick question. Im working on my first 2.x migration form 1.x when running the "drush migrate:import --group=farm_migrate_area" I get an error " IllegalArgumentException: Points of LinearRing do not form a closed linestring". Any thoughts on this?
16:46symbioquine[m]Maybe related to farmos.discourse.group/t/issue-adding-ar (In that there could be differences in the pure-PHP geometry parsing vs GEOS.
16:46symbioquine[m])
16:47symbioquine[m]* vs GEOS.)
16:56botlfarm[m]Thanks. Any idea on tracking down which land asses may be causing this problem without going in and checking them 1 at a time?
17:10botlfarm[m]Actually looks like I found an area in my production site that will not even open. When I click on it I get "The website encountered an unexpected error. Please try again later." I only have a handful of logs associated with this area, I don't use it very often.
18:15mstenta[m]botlfarm try opening the edit form for that asset directly if you can
18:15mstenta[m]Sounds like an invalid geometry
18:15mstenta[m]A polygon that doesn't close
18:15mstenta[m]You may be able to fix it if you can get to the edit form
18:16mstenta[m]Otherwise you might need to edit the database directly

< 172021-09-18⋏19 >