Add an option to control whether "in-kind value" of each item should be added in export of donations and distributions#4897
Conversation
41722bc to
a21bf2d
Compare
cielf
left a comment
There was a problem hiding this comment.
I'm suggesting some expanded text around the instructions.
|
|
||
| [!NOTE] This includes inactive Items as well as active ones. | ||
|
|
||
| ### Add In-Kind Value for each item |
There was a problem hiding this comment.
Please add something like "The default export includes the number of items exported, but not the values. If you want to also have the export include the in-kind value for each item in the distributions, you can set that option." before the instructions.
And after, please add a "[!NOTE] Setting this affects both the donation and distribution exports."
|
|
||
| ### Add In-Kind Value for each item | ||
| Click "My Organization" in the left hand manu. Click "Edit" button. Set the "Include in-kind value in donation and distribution exports?" to "yes". | ||
|
|
There was a problem hiding this comment.
Please add similar text as noted above in the distribution section.
|
|
||
| ### Add In-Kind Value for each item | ||
| Click "My Organization" in the left hand manu. Click "Edit" button. Set the "Include in-kind value in donation and distribution exports?" to "yes". | ||
|
|
There was a problem hiding this comment.
to "yes", then click "Save".
62279c2 to
4ae30dc
Compare
What contents should I add in this file? |
Well -- I would add a section, at the same level as "customizing the distribution printout", called "Configuring exports", then a subsection for the field. In that, I would talk about what the default distribution and donation exports are (as you did in the exports section), and the effect that setting this field to "yes' will have. IIRC, your new field is just before "Distribution Email Content". If that's right, put the new section there. |
4ae30dc to
d8051fe
Compare
It seems odd to me that there is a second-level section between two fourth-level sections. |
Yeah (haven't checked yet) We need to do some reorganization of that screen so that same-concepted things are together - but that's out of scope for this change. |
|
|
||
| ## Configuring exports | ||
|
|
||
| ### Add In-Kind Value for each item |
There was a problem hiding this comment.
Make this the whole field name -- i.e. Include in-kind value in donation and distribution exports?
This matches the practice for the field-level sections in the rest of the file.
|
|
||
| ### Add In-Kind Value for each item | ||
|
|
||
| You can configure whether the export file includes the "In-Kind Value" column for each item. By default, these values are excluded. To include them, set the "Include in-kind value in donation and distribution exports?" option to "Yes". |
There was a problem hiding this comment.
please change "the export file includes " to "the exports for donations and distributions include "
…be added in export of donations and distributions
d8051fe to
a15b1de
Compare
cielf
left a comment
There was a problem hiding this comment.
Hey @nozomirin . This looks pretty good to me from a functional pov.
One note -- when you do a force push it makes it harder for the reviewers, because they can't see the incremental changes.
Over to @dorner for technical review
dorner
left a comment
There was a problem hiding this comment.
Overall looks great - I had a request for the tests.
| @@ -0,0 +1,6 @@ | |||
| class AddIncludeInKindValuesInExportedFilesToOrganizations < ActiveRecord::Migration[7.2] | |||
| def change | |||
| add_column :organizations, :include_in_kind_values_in_exported_files, :boolean | |||
There was a problem hiding this comment.
This should be NOT NULL. Otherwise it's got three values, true false and null. :)
| distribution.comment | ||
| ] | ||
|
|
||
| row += quantities_and_values_of_item.flat_map { |item| [item[:quantity], item[:value].to_f] } |
There was a problem hiding this comment.
We really should be setting up the data using explicit values rather than trying to calculate aggregations of random values. If it's not too much work, would you be able to make that change?
There was a problem hiding this comment.
@nozomirin FYI, we will be addressing those inconsistencies in PR4924. I'd like to get this one in first if we can.
I will change this test later in another PR.
|
|
||
| row += item_quantities | ||
|
|
||
| expect(item_quantities.sum).to eq(total_item_quantity) |
I understand that I should not force push after a review. Got it—this won't happen again. |
|
If the filter is set to item A, the total number is the number of A. But what is the 'total value'? Is it the value of A or the value of the entire distribution? |
|
We recently merged a change to make it so that the filtered values on the index reflect only the values for the items in the filter. The export should match that. I don't recall immediately if the export was addressed at that time, but suggest you merge main into your branch and confirm. |
|
I pulled and tested it on the main branch. The total value represents the value of the entire distribution. |
|
Huh. I thought we'd addressed that. I'm going to have to track down what happened there (and I can't do that in the next few minutes. Maybe later today). The export should match the index. |
|
I've dug into this a bit more. For the scope of this PR, leave the total value as is. We have some inconsistencies between how we are handling filtering by item and filtering by item category in the export that need to be resolved, but it's out of scope for this PR. |
|
@nozomirin FYI, we will be addressing those inconsistencies in PR4924. I'd like to get this one in first if we can. |
|
This seems to have fallen through the cracks.... and there have been a few changes since that are causing confilcts. In the meantime we addressed the question of total value regarding the item and item category filtering. @dorner Can you take a look at the resolution of your concerns above, then I think we may have a semi-gnarly conflict resolution to do. |
|
I asked for a change to the tests which wasn't done. |
|
@nozomirin -- Just a last check -- are you still working on this? There are still changes that were asked for and not changed. (If we don't hear from you by the 29th, we'll assume this is is abandoned and we can ask someone else to finish it up.) |
|
Closing this PR, as @nozomirin has submitted a fresh one. |
Resolves #4858
Description
in-kind valuefor each item in exported donation and distribution files when theInclude in-kind value in donation and distribution exports?is set toyes.Note: I changed the "In-Kind Value" header to "In-Kind Total" in the exported donation file to avoid ambiguity. However, I used "Header + In-Kind Value" for the in-kind value of items, so perhaps the change is unnecessary. If there’s anything incorrect or unclear, please let me know.
Type of change
How Has This Been Tested?
Screenshots