Skip to content

Conversation

@Banibrata-Manna
Copy link
Contributor

  • Show the list of IN_PROGRESS Counts in assigned page and it's sessions,
  • Added a base modal template to add new session.
  • Added an api service in count service to post the new Count Session for given Count with demo payload.

@gemini-code-assist
Copy link

Summary of Changes

Hello @Banibrata-Manna, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the cycle count management feature by introducing the ability to view "IN_PROGRESS" counts along with their individual sessions directly on the assigned page. It also provides a streamlined user experience for creating new count sessions through a dedicated modal and integrates the necessary API calls to support this functionality.

Highlights

  • In-Progress Counts Display: The assigned page now shows a list of "IN_PROGRESS" counts and their associated sessions.
  • New Session Modal: A reusable modal component (AddNewSessionModal.vue) has been introduced to facilitate the creation of new count sessions.
  • API Service for Sessions: A new API service (addSessionInCount) has been added to CountService.ts to enable posting new count sessions for a given count.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces functionality for displaying 'in-progress' counts and adding new count sessions. While the changes are a good step forward, there are several areas that need attention. A critical issue is the use of hardcoded data in the new session modal, which renders it non-functional for production use. Additionally, there are several instances of debugging console.log statements that should be removed, and opportunities for code improvement in terms of type safety, refactoring, and fixing a potential bug with a v-for key. Addressing these points will significantly improve the quality and robustness of the code.

Comment on lines 37 to 47
function addNewSession() {
CountService.addSessionInCount({
countImportName: "Test Count From Modal",
statusId: "CYCLE_CNT_CREATED",
uploadedByUserLogin: "hotwax.user",
facilityAreaId: "Basement Vault 786",
createdDate: Date.now(),
dueDate: Date.now(),
workEffortId: "M100877"
});
}

Choose a reason for hiding this comment

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

critical

The addNewSession function uses a hardcoded payload to create a new session. This is not suitable for production and appears to be for demonstration purposes. The data for the new session, particularly the workEffortId, should be passed into this component as a prop. Other details should be collected from the user via form inputs within the modal, which is currently empty.

</ion-card>

<ion-card v-for="count in cycleCount" :key="count.inventoryCountImportId" @click="navigateToStoreView(count)" button>
<ion-card v-for="count in cycleCount" :key="count.inventoryCountImportId">

Choose a reason for hiding this comment

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

high

The :key for the v-for loop is count.inventoryCountImportId. However, the count object is a "work effort" from getAssignedWorkEfforts and may not have this property. A more appropriate and stable key would be count.workEffortId. Using an incorrect or non-unique key can lead to unpredictable rendering behavior in Vue.

        <ion-card v-for="count in cycleCount" :key="count.workEffortId">

params
});
}
const getInventoryCountImportsByWorkEffort = async (params: any): Promise <any> => {

Choose a reason for hiding this comment

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

medium

The params and return types are any. Using specific types would improve type safety and code maintainability. For example, params could be typed as { workEffortId: string }. Please also define an interface for the response object.

});
}

const addSessionInCount = async (payload: any): Promise<any> => {

Choose a reason for hiding this comment

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

medium

The payload and return types are any. Using specific types would improve type safety and code maintainability. Please define an interface for the payload (e.g., AddSessionPayload) and use it here. Also, consider typing the response.

}
}

console.log("These are counts: ", assignedWorkEfforts);

Choose a reason for hiding this comment

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

medium

This console.log statement appears to be for debugging. It should be removed before merging into the main branch.

<ion-item-group v-for="session in count.sessions" :key="session.inventoryCountImportId">
<ion-item>
<ion-label>
{{ session.countImportName }} + {{ session.facilityAreaId }}

Choose a reason for hiding this comment

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

medium

The concatenation {{ session.countImportName }} + {{ session.facilityAreaId }} seems like placeholder text for development. This should be formatted in a more user-friendly way for the final UI.

                  {{ session.countImportName }} ({{ session.facilityAreaId }})

const currentFacility = computed(() => userStore.getCurrentFacility)
const cycleCountStats = computed(() => (id) => store.getters["count/getCycleCountStats"](id))
// const cycleCountStats = computed(() => (id) => store.getters["count/getCycleCountStats"](id))
const userProfile = store.getters["user/getUserProfile"];

Choose a reason for hiding this comment

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

medium

The userProfile constant is declared but never used within the component. It should be removed to avoid dead code.

Comment on lines 301 to 315
// TODO: Fetch the status description when the app loads.
function getSessionStatusDescription(statusId) {
if (!statusId) {
return "";
}
if (statusId === "INV_COUNT_CREATED") {
return "Created";
} else if (statusId === "CYCLE_CNT_IN_PRGS") {
return "In Progress";
} else if (statusId === "CYCLE_CNT_IN_CMPLTD") {
return "Completed";
} else {
return "Cancelled"
}
}

Choose a reason for hiding this comment

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

medium

The getSessionStatusDescription function uses a chain of if/else if statements. This can be refactored into a more readable and maintainable structure using a map or an object lookup. This also makes it easier to add new statuses in the future. The hardcoded status IDs should also be defined as constants.

// TODO: Fetch the status description when the app loads.
const sessionStatusDescriptions: Record<string, string> = {
  "INV_COUNT_CREATED": "Created",
  "CYCLE_CNT_IN_PRGS": "In Progress",
  "CYCLE_CNT_IN_CMPLTD": "Completed",
};

function getSessionStatusDescription(statusId: string): string {
  if (!statusId) {
    return "";
  }
  return sessionStatusDescriptions[statusId] || "Cancelled";
}

currentStatusId: getStatusIdForCountsToBeFetched()
};
await store.dispatch("count/fetchCycleCountsLists", payload);
console.log("This is store: ", store);

Choose a reason for hiding this comment

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

medium

This console.log statement appears to be for debugging. It should be removed before merging.

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.

2 participants