Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lf 4473 add new animal movement task type to pure task type selection component #3502

Open
wants to merge 5 commits into
base: integration
Choose a base branch
from

Conversation

Duncan-Brain
Copy link
Collaborator

@Duncan-Brain Duncan-Brain commented Oct 18, 2024

Description

  • Adds new icon to task type selection
  • Updates stories as available
  • Extra: Adds to task card options
  • Extra extra: adds a filter to hide animalTasks if coming from crop management plan task flow

Notes:

  • Not visible in app until database is updates
  • In translations there is a _LOWER for other task types -- anyone know where this is used? I cant find it so did not add for MOVEMENT
  • No stories to edit for task card ...heres what it looks like in the task card story:
    Screenshot 2024-10-18 at 1 01 07 PM

Jira link: LF-4473

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Passes test case
  • UI components visually reviewed on desktop view
  • UI components visually reviewed on mobile view
  • Other (please explain):
  • need to manually add MOVEMENT_TASK to taskType in PureTaskTypeSelection:

I used this function which did not work perfectly but did the job:

if(!taskTypes.find((type) => {type.task_translation_key === 'MOVEMENT_TASK'})) {
    taskTypes.push({
      deleted: false,
      farm_id: null,
      task_name: "Movement",
      task_translation_key: "MOVEMENT_TASK",
      task_type_id: 20
    });
  }

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • The precommit and linting ran successfully
  • I have added or updated language tags for text that's part of the UI
  • I have added "MISSING" for all new language tags to languages I don't speak
  • I have added the GNU General Public License to all new files

@Duncan-Brain Duncan-Brain requested review from a team as code owners October 18, 2024 17:02
@Duncan-Brain Duncan-Brain requested review from antsgar and kathyavini and removed request for a team October 18, 2024 17:02
@Duncan-Brain Duncan-Brain changed the title Lf 4473 add new animal movement task type to pure task type selection component [NOT URGENT] Lf 4473 add new animal movement task type to pure task type selection component Oct 18, 2024
@Duncan-Brain Duncan-Brain self-assigned this Oct 18, 2024
@Duncan-Brain Duncan-Brain changed the title [NOT URGENT] Lf 4473 add new animal movement task type to pure task type selection component [Ready but not urgent] Lf 4473 add new animal movement task type to pure task type selection component Oct 18, 2024
@antsgar
Copy link
Collaborator

antsgar commented Oct 21, 2024

@Duncan-Brain looks like the _lower strings were used a while ago for a prompt that read "Tell us about your [task type] task" but we've changed it forever ago

antsgar
antsgar previously approved these changes Oct 21, 2024
@Duncan-Brain Duncan-Brain changed the title [Ready but not urgent] Lf 4473 add new animal movement task type to pure task type selection component Lf 4473 add new animal movement task type to pure task type selection component Oct 23, 2024
@Duncan-Brain
Copy link
Collaborator Author

Duncan-Brain commented Oct 25, 2024

Thanks @antsgar I removed them so as not to confuse others in the future. I finally found the use of _LOWER you mention here: 2a25cde#diff-b41a29e7942af162f245d82d225d73b6303f015de760bb6d3b2d1efdaa81be70R92 and the file has since been moved+updated

The filter for taskTypes when coming from crop plan has also now been added and is ready for re-review

@SayakaOno SayakaOno requested review from SayakaOno and removed request for kathyavini October 25, 2024 17:48
antsgar
antsgar previously approved these changes Oct 25, 2024
@@ -123,7 +126,15 @@ export const PureTaskTypeSelection = ({
{taskTypes
?.filter(({ farm_id, task_translation_key }) => {
const supportedTaskTypes = getSupportedTaskTypesSet(isAdmin);
return farm_id === null && supportedTaskTypes.has(task_translation_key);
// If trying to make a task through the crop management plan Add Task link -- exclude animal tasks from selection for now
const isNotAnimalTaskWhileCreatingCropTask = !(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker for merging, but the variable name is confusing me more 😂 I'd rename it to shouldDisplayTaskType, which is the result, and then the statement afterwards is what contains the logic for displaying or not

Copy link
Collaborator Author

@Duncan-Brain Duncan-Brain Nov 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I specifically did not group it with the other logic... I personally prefer to separate long ,tough to read, logic into "readable chunks" . So, in my head, I read the return statement below as: isLiteFarmDefaultTaskType && isSupportedTaskType && isNotAnimalTaskWhileCreatingCropTask.

The name is wordy I am open to a better name ahaha. But the logic points do seem distinct to me.

I did an inbetween change to address this comment -- let me know if its ok!

Copy link
Collaborator

@SayakaOno SayakaOno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great overall! I just left a few comments with some suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants