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

Fixed: Jobs repeatation in moreJobs sections on all pages(#2vjxdha) #296

Merged
merged 8 commits into from
Nov 24, 2022

Conversation

shashwatbangar
Copy link
Contributor

@shashwatbangar shashwatbangar commented Nov 23, 2022

Related Issues

Closes #257

Short Description and Why It's Useful

We have hardcoded jobs at the top of pages & below we have moreJobs section, earlier hardCoded jobs were are shown in moreJobs section which is wrong. This happened because enumTypeId were same for both. Now fixed it.

Screenshots of Visual Changes before/after (If There Are Any)

IMPORTANT NOTICE - Remember to add changelog entry

Contribution and Currently Important Rules Acceptance

@shashwatbangar shashwatbangar changed the title Fixed: Jobs repeatation in moreJobs sections in all pages(#2vjxdha-n) Fixed: Jobs repeatation in moreJobs sections on all pages(#2vjxdha-n) Nov 23, 2022
@shashwatbangar shashwatbangar changed the title Fixed: Jobs repeatation in moreJobs sections on all pages(#2vjxdha-n) Fixed: Jobs repeatation in moreJobs sections on all pages(#2vjxdha) Nov 23, 2022
@@ -40,7 +40,7 @@
<ion-toggle slot="end" :checked="deleteProductsWebhook" @ionChange="updateWebhook($event['detail'].checked, 'DELETE_PRODUCTS')" color="secondary" />
</ion-item>
</ion-card>
<MoreJobs v-if="moreJobs.length" :jobs="moreJobs" :jobEnums="jobEnums" />
<MoreJobs v-if="getMoreJobs(jobEnums, 'PRODUCT_SYS_JOB').length" :jobs="getMoreJobs(jobEnums, 'PRODUCT_SYS_JOB').length" :jobEnums="jobEnums" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Define a local property to declare the enumTypeId value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done sir

@@ -500,7 +495,7 @@ export default defineComponent({
if (this.currentEComStore.productStoreId) {
this.getAutoCancelDays();
}
this.fetchMoreJobs();
// this.moreJobs = this.getMoreJobs(this.jobEnums, "ORDER_SYS_JOB");
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this comment if not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done sir


return Object.values(jobs)
return Object.keys(state.cached).reduce((orders: any, enumId: any) => {
if(orderJobEnumIds.indexOf(enumId) === -1 && state.cached[enumId]?.enumTypeId === enumTypeId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead in place of indexOf, I think using includes will be a good option.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure sir

return Object.values(jobs)
return Object.keys(state.cached).reduce((orders: any, enumId: any) => {
if(orderJobEnumIds.indexOf(enumId) === -1 && state.cached[enumId]?.enumTypeId === enumTypeId) {
orders.push(state.cached[enumId])
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should change order specific variable name, the same getter is being used on all pages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right sir. Fixed it.


return Object.values(jobs)
return Object.keys(state.cached).reduce((orders: any, enumId: any) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return Object.keys(state.cached).reduce((orders: any, enumId: any) => {
return Object.keys(state.cached).reduce((orders: any, enumId: string) => {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


return Object.values(jobs)
return Object.keys(state.cached).reduce((jobs: any, enumId: string) => {
if(!orderJobEnumIds.includes(enumId) && state.cached[enumId]?.enumTypeId === enumTypeId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should first check enumTypeId as it will have many other types of jobs and it is better to avoid includes operation for other types

Suggested change
if(!orderJobEnumIds.includes(enumId) && state.cached[enumId]?.enumTypeId === enumTypeId) {
if(state.cached[enumId]?.enumTypeId === enumTypeId && !orderJobEnumIds.includes(enumId)) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done sir

"enumTypeId": "INVENTORY_SYS_JOB",
},
});
getMoreJobs(jobEnums: any, enumTypeId: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this is needed? we could directly use moreJobs(jobEnums, enumTypeId)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes sir. Fixed it.

@@ -357,7 +357,7 @@ const actions: ActionTree<JobState, RootState> = {
...payload.inputFields
},
"noConditionFind": "Y",
"viewSize": (payload.inputFields?.systemJobEnumId?.length * 3)
"viewSize": (payload.inputFields?.systemJobEnumId?.length * 3) || 30
Copy link
Contributor

Choose a reason for hiding this comment

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

We should increase this value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure sir. Increased it to 50

…ier to show moreJobs we had a getter which is called inside a method, we can directly call that getter and pass values inside it(#2vjxdha-n)
…returns a value from getter, we should give it name starting with get(#2vjxdha-n)
@adityasharma7 adityasharma7 merged commit c911dda into hotwax:main Nov 24, 2022
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.

Implement more jobs section on all pages
3 participants