[04:00:13] | * shane_aldrich[m] has quit (Quit: You have been kicked for being idle) |
[07:58:36] | <skipper_is[m]> | Left the migration going overnight, seems to be all in order this morning! Now I can start to migrate across some modules |
[07:58:47] | <mstenta[m]> | wahoo! |
[07:59:06] | <mstenta[m]> | well - glad we identified those mysql migration issues |
[07:59:25] | <mstenta[m]> | hopefully that won't affect many folks... but good to have a bug report open for them |
[07:59:32] | <mstenta[m]> | i'll add the bit about sensors being affected as well |
[08:01:16] | <skipper_is[m]> | Has anyone made a start on the Quick Form for births? |
[08:02:27] | <mstenta[m]> | nope not yet |
[08:03:06] | <skipper_is[m]> | Ok, I'll maybe make a start there as the goats are kidding now |
[08:04:23] | <mstenta[m]> | might be a pretty easy one to throw together! |
[08:04:24] | <skipper_is[m]> | I'll do it as a contrib module, that way if someone wants to make a better one they can :) |
[08:04:30] | <mstenta[m]> | i wish i had a few spare moments! i would help! |
[08:04:53] | <mstenta[m]> | sounds good - yea i hope to rebuild it in farmOS core too - but anything you start with would be great! |
[08:04:56] | <skipper_is[m]> | Well, I'll see where I get stuck and then give you a shout for when you're free |
[08:06:23] | <mstenta[m]> | i have a few moments right now - want me to start a quick branch with a skeleton module? |
[08:07:05] | <skipper_is[m]> | You can, but I was going to do it as a contrib just so I can drop it into sites/all/modules for easy quick testing, rather than mapping out an extra folder for the core modules |
[08:07:20] | <skipper_is[m]> | Then if it works, it can go across to the core |
[08:14:24] | <skipper_is[m]> | Does this comment section do anything?... (full message at https://libera.ems.host/_matrix/media/r0/download/libera.chat/9007fbc2fc...) |
[08:16:16] | <mstenta[m]> | https://github.com/farmOS/farmOS/compare/2.x...mstenta:2.x-quick-birth |
[08:16:23] | <mstenta[m]> | here's a quick start, if it's helpful! |
[08:16:43] | <mstenta[m]> | yes that's a "PHP annotation" which is used for some plugin metadata |
[08:17:00] | <skipper_is[m]> | Ah ok |
[08:17:00] | <mstenta[m]> | (feel free to copy those files i started to your own repo) |
[08:18:08] | <skipper_is[m]> | Ah, forgot we're getting electricians over today. I'd better shut my computer down before they turn off the power! |
[08:18:17] | <skipper_is[m]> | That is rather annoying... another day |
[08:18:30] | <mstenta[m]> | haha well if i have some free time maybe i'll add a bit more to this :-) |
[08:18:40] | <mstenta[m]> | you've got me inspired |
[08:18:50] | <skipper_is[m]> | Go for it! |
[08:18:58] | <skipper_is[m]> | I'll pick another one :P |
[13:28:04] | <symbioquine[m]> | ACTION uploaded an image: (50KiB) < https://libera.ems.host/_matrix/media/r0/download/matrix.org/iJNtuOEJLXH... > |
[14:56:56] | <skipper_is[m]> | quantity_measure_options() brings in the available quantity units doesnt it? |
[14:58:09] | <skipper_is[m]> | But what is this even doing:... (full message at https://libera.ems.host/_matrix/media/r0/download/libera.chat/6c9f494d9d...) |
[14:58:35] | <skipper_is[m]> | Is it just returning an empty array if there are no quantity options? |
[14:59:31] | <skipper_is[m]> | Oh, nvm, you can pass measures to the overall function, so it just filters it for them |
[15:17:15] | <mstenta[m]> | ps skipper_is i made some progress on the birth quick form this morning |
[15:17:38] | <skipper_is[m]> | I saw, I'm working on the quick weight module now |
[15:17:54] | <skipper_is[m]> | Defined the form, now working on the submit logic |
[15:18:16] | <mstenta[m]> | ACTION uploaded an image: (194KiB) < https://libera.ems.host/_matrix/media/r0/download/matrix.org/vQsEmQMBbui... > |
[15:18:35] | <mstenta[m]> | no submit logic yet... but i sketched out the basic fields (parity with farmOS v1 anyway) |
[15:18:42] | <skipper_is[m]> | Needs birth weight :P |
[15:19:08] | <mstenta[m]> | (oh also the "group membership" piece still needs to be added too... that part will be conditional based on whether or not `farm_group` is installed) |
[15:19:14] | <mstenta[m]> | oh good idea - we should add birth weight |
[15:19:24] | <skipper_is[m]> | There is one in 1x isn't there? |
[15:19:31] | <mstenta[m]> | i suppose that should be in a separate observation log for each child? |
[15:19:31] | <skipper_is[m]> | Or is that something custom in mine? |
[15:19:38] | <mstenta[m]> | no v1 didn't have that |
[15:19:50] | <skipper_is[m]> | Oh... Is that something I've added? I was sure not |
[15:20:12] | <skipper_is[m]> | ACTION uploaded an image: (47KiB) < https://libera.ems.host/_matrix/media/r0/download/matrix.org/AerczfNFoMO... > |
[15:20:26] | <skipper_is[m]> | It creates an observation log at the same time |
[15:21:00] | <mstenta[m]> | hmm yea that must have been custom? |
[15:21:03] | <mstenta[m]> | here's the v1 code: https://github.com/farmOS/farmOS/blob/7.x-1.x/modules/farm/farm_livestoc... |
[15:21:26] | <skipper_is[m]> | How do we get the asset from what they've typed? In 1.x it was through _form_validate |
[15:21:39] | <mstenta[m]> | oh wait! |
[15:21:44] | <mstenta[m]> | ah ha! |
[15:21:44] | <mstenta[m]> | https://github.com/farmOS/farmOS/blob/509cfb2e928ef7537977a0f53eb93ee12a... |
[15:22:03] | <mstenta[m]> | the `farm_livestock_weight` module actually altered the birth quick form in v1 to add birth weight! i totally forgot about that |
[15:22:13] | <mstenta[m]> | whelp - yea i guess we should add that too |
[15:22:51] | <skipper_is[m]> | Ah! I was wildly looking through my repo trying to find if I'd put it in |
[15:23:14] | <mstenta[m]> | i have no memory of writing that code 😆 |
[15:25:52] | <skipper_is[m]> | But yea, getting the asset they've typed in, is there a 2.x version of form_validate? |
[15:26:50] | <skipper_is[m]> | The planting one the asset is created, so it can just be passed to the log builder, similar in the egg module, |
[15:27:12] | <mstenta[m]> | yea `public function validateForm()` (same arguments as `submitForm()`) |
[15:27:33] | <mstenta[m]> | oh wait is that what you're asking? |
[15:28:04] | <skipper_is[m]> | It is, and would that be similar to 1.x in terms of validating what the use has put in for asset? |
[15:28:06] | <mstenta[m]> | that's where you can perform any custom validation you might need, and use `$form_state->setError()` (iirc) |
[15:28:21] | <skipper_is[m]> | eg in the birth log, that they've put in a valid mother |
[15:28:21] | <mstenta[m]> | yes - `$form_state->getValue()` will get the submitted values |
[15:28:30] | <mstenta[m]> | oh ok so... some of that is handled automatically |
[15:28:43] | <mstenta[m]> | via the `"#type" => "entity_autocomplete"` widget |
[15:28:46] | <skipper_is[m]> | Aah |
[15:28:49] | <mstenta[m]> | so you don't even need to validate that |
[15:28:53] | <skipper_is[m]> | Sweet |
[15:29:03] | <skipper_is[m]> | Oh that saves me a right headache! |
[15:30:34] | <skipper_is[m]> | but I can pull the asset from that via `$asset = $form_state->getValue("asset");`? |
[15:33:09] | <mstenta[m]> | yea take a look at the way the planting quick form submit logic works... there may be some "gotchas" if i remember correctly... i forget exactly what that gives you |
[15:33:40] | <skipper_is[m]> | The planting submit creates a new asset of planting, so it doesn't need to get the asset from entity_autocomplete |
[15:34:08] | <skipper_is[m]> | it is just passed the newly created asset I think |
[15:36:12] | <skipper_is[m]> | Oh, but location does some additional logic on the field value to get the location_id, and from that the location asset... (full message at https://libera.ems.host/_matrix/media/r0/download/libera.chat/a5ac314b72...) |
[15:37:02] | <mstenta[m]> | oh right... yes it references a few other things - location, crop/variety etc |
[15:37:18] | <mstenta[m]> | there's a bit of a different behavior depending on whether or not you are "auto-creating" a new asset |
[15:37:24] | <mstenta[m]> | but i think referencing and existing asset is simpler |
[15:37:29] | <mstenta[m]> | s/and/an/ |
[15:37:29] | <skipper_is[m]> | crop/variety are just taxonomy terms through aren't they? |
[15:37:42] | <mstenta[m]> | yup |
[15:37:50] | <mstenta[m]> | but those are entities too - so the same type of widget is used |
[15:37:56] | <skipper_is[m]> | Ooh ok |
[15:39:21] | <skipper_is[m]> | $asset_id = $form_state->getValue('asset');... (full message at https://libera.ems.host/_matrix/media/r0/download/libera.chat/186c9e7a43...) |
[15:39:34] | <skipper_is[m]> | I'm not happy with the chance of it returning nothing though... |
[15:39:50] | <skipper_is[m]> | It shouldn't... the form has it required.... |
[15:41:00] | <skipper_is[m]> | ..Oh what if it's more than one asset... |
[15:41:24] | <skipper_is[m]> | Ahh, []... |
[15:54:58] | <skipper_is[m]> | `[$this->prepareQuantity($log_values['quantity'])],` Where is this function defined? I cannot seem to find a definition to see what args it takes? |
[15:55:16] | <mstenta[m]> | oh that's specific to the planting quick form class |
[15:55:56] | <mstenta[m]> | easier way is:... (full message at https://libera.ems.host/_matrix/media/r0/download/libera.chat/c26f7a832b...) |
[15:56:00] | <skipper_is[m]> | Ah nice :) |
[15:56:05] | <skipper_is[m]> | units? |
[15:56:10] | <mstenta[m]> | the `createLog()` method will handle that automatically |
[15:56:19] | <mstenta[m]> | i forget... i think you can just put the unit name |
[15:56:32] | <mstenta[m]> | (in a meeting at the moment) |
[15:57:45] | <skipper_is[m]> | 'quantity' => [ |
[15:57:45] | <skipper_is[m]> | ['value' => $weight, |
[15:57:45] | <skipper_is[m]> | 'unit' => $unit,], |
[15:57:45] | <skipper_is[m]> | ], |
[15:57:55] | <skipper_is[m]> | oh, measure not value |
[15:58:00] | <skipper_is[m]> | no, ignore measure... |
[16:55:32] | <skipper_is[m]> | Got an autocomplete issue... go to extract the asset from the form field, using `$asset = $this->entityTypeManager->getStorage('asset')->load($id);` where $id is the value from the form field, (I'm using a similar pattern to the planting seasons taxonomy). My animals names are recorded as "Nala (71)" where 71 is her eartag number. The id is returning her eartag number as her asset id number, and then saying it obviously cannot find asset |
[16:55:32] | <skipper_is[m]> | with id number of 71 because that isn't her number... |
[16:59:44] | <mstenta[m]> | Ohh man... I ran into this recently too |
[16:59:54] | <skipper_is[m]> | One of those gotchas... |
[17:00:13] | <mstenta[m]> | https://github.com/farmOS/farmOS/issues/503 |
[17:00:47] | <mstenta[m]> | Similar to that issue... I think this same thing happens in a few different places when you have entities with parentheses in the name |
[17:01:28] | <skipper_is[m]> | It probably would've happened in 1.x with the square brackets, but very few people put square brackets in names.. |
[17:01:54] | <mstenta[m]> | Oh was it square bracket in v1? I forget |
[17:02:00] | <skipper_is[m]> | although that was [id:123] |
[17:02:02] | <mstenta[m]> | That's all Drupal core behavior |
[17:02:02] | <skipper_is[m]> | so probably less likely |
[17:02:10] | <mstenta[m]> | So a bit out of our control |
[17:02:19] | <mstenta[m]> | Dang huh. I wonder why they changed it |
[17:02:24] | <mstenta[m]> | That's no good |
[17:02:46] | <mstenta[m]> | I link to the upstream core issue in that GitHub link |
[17:02:53] | <skipper_is[m]> | But the ids aren't being referenced in the name, so if I pull in a different asset without that (), there isn't the asset id in it's place |
[17:03:54] | <skipper_is[m]> | ACTION uploaded an image: (7KiB) < https://libera.ems.host/_matrix/media/r0/download/matrix.org/mwJbJihoefr... > |
[17:03:58] | <mstenta[m]> | Oh wait actually |
[17:04:00] | <skipper_is[m]> | He doesn't get a (id) |
[17:04:14] | <mstenta[m]> | skipper_is: there might be a partial fix in the 2.x branch |
[17:04:20] | <mstenta[m]> | Soon to be in beta3 |
[17:04:53] | <mstenta[m]> | https://github.com/farmOS/farmOS/issues/502 |
[17:05:30] | <mstenta[m]> | Sorry need to run... You might consider applying that change to your code manually and see if it works better |
[17:05:43] | <mstenta[m]> | It is already committed, but after beta2 |
[17:06:25] | <skipper_is[m]> | No worries |
[17:07:00] | <mstenta[m]> | I think that parentheses issue is coming up in a few places though so that might only fix one |
[17:07:18] | <mstenta[m]> | Not sure if it's the same one you are experiencing but worth a try! |
[17:21:15] | <skipper_is[m]> | It was first reported on Drupal forums 7 years ago! Still broken! |
[17:22:26] | <skipper_is[m]> | 6 years ago it was reported.. |
[17:23:00] | <skipper_is[m]> | https://www.drupal.org/node/2520416 |