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

RUN-2032: Percentage in number showing in progress bar instead of undefined% #8974

Merged
merged 4 commits into from Mar 13, 2024

Conversation

jayas006
Copy link
Contributor

@jayas006 jayas006 commented Mar 2, 2024

Is this a bugfix, or an enhancement? Please describe.

"undefined%" message appears in the progress bar instead of percentage. Fixed it to make it shows the percentage in number.

Describe the solution you've implemented

Describe alternatives you've considered

Additional context

@jayas006 jayas006 added this to the 5.2.0 milestone Mar 2, 2024
Copy link
Contributor

@smartinellibenedetti smartinellibenedetti left a comment

Choose a reason for hiding this comment

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

One heads-up, one common habit that engineers develop is to validate solutions before implementing them to avoid missing important aspects.

The architecture meeting on Mondays is an example of folks validating their ideas.

Whenever starting to work on a task that doesn't have steps regarding how to solve it, l'd like you to investigate the issue and send me or other folks a message with the plan of how this issue will be solved.

In this type of communication, it is also helpful to point out how you concluded that what you're solving is the problem in the first place.

This will help us to ensure you're on the right track, and that you have all the info you need, so that once you execute your plan, the PR is ready for review.

Currently, this will be moved back to in progress, and we can discuss it more tomorrow.

@@ -288,29 +288,31 @@
class="dateStarted date"
colspan="2"
>
<!--getting vue warning: Invalid prop: type check failed for prop "modelValue".Converted :value to :modelValue-->
Copy link
Contributor

Choose a reason for hiding this comment

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

A few things here:

  • good job correctly interpreting the vue warning;

  • whenever possible, it's good to avoid adding comments to the template as they get rendered in the dev tools;

  • the gist of adding comments is to help to clarify why something was done in a specific way, that may not be obvious by just reading the code. Therefore it is good to think who the audience is, and its relevance - including if there is any other mechanism that could alert/prevent this issue from happening.

In this case, vue will emit warnings that will help the team avoid making this mistake, which means, there isn't much value registering as a comment that value isn't an acceptable prop anymore.

As for the audience, please let me know if I'm wrong, but I believe that you meant to leave this comment for the PR reviewer. Whenever that's the case, please use the github functionality to comment in the PR itself.

  • therefore, please ✂️ this comment

striped
type="default"
label
:label-text="
$t('job.execution.starting.0', [
runningStartedDisplay(exec.dateStarted.date),
// if exec.dateStarted is null or undefined,it doesn't throw an error but instead returns undefined
runningStartedDisplay(exec.dateStarted?.date) || 'N/A',
Copy link
Contributor

Choose a reason for hiding this comment

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

Question, what led you to the conclusion that this change was needed? Have you seen a scenario where this happens?

Copy link
Contributor Author

@jayas006 jayas006 Mar 5, 2024

Choose a reason for hiding this comment

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

Question, what led you to the conclusion that this change was needed? Have you seen a scenario where this happens?

I was going through line by line code between progress bar (first I saw in vue dev tool to confirm which line of code I have to see to make it right) and started understanding the functions. So the runningStartedDispaly requires the valid date to return the right output. I did some changes and still it didn't work. Then I applied ternary operator(with the help of few google search) to debug the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Question, what led you to the conclusion that this change was needed? Have you seen a scenario where this happens?

Ok so I fixed it now. It was just unnecessary change from my side. Ignore it

const now = moment();
const startDate = moment(exec.dateStarted.date);
const diff = now.diff(startDate);
const percentage = Math.floor((diff / exec.job.averageDuration) * 100);
Copy link
Contributor

Choose a reason for hiding this comment

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

One heads-up, if it's the first time running a job, averageDuration isn't available. We shouldn't be showing 0 in this case.

@@ -801,6 +802,25 @@ export default defineComponent({
}
return 0;
},

// Below code makes the progress bar reach closer to 100%
Copy link
Contributor

Choose a reason for hiding this comment

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

✂️

@fdevans fdevans changed the title RUN-2032: percentage in number showing in progress bar instead of undefined% RUN-2032: Percentage in number showing in progress bar instead of undefined% Mar 7, 2024
Copy link
Contributor

@smartinellibenedetti smartinellibenedetti left a comment

Choose a reason for hiding this comment

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

good job!

@jayas006 jayas006 merged commit 7ad5838 into main Mar 13, 2024
3 checks passed
@jayas006 jayas006 deleted the feat/fixing-progress-bar-in-activityList branch March 13, 2024 16:24
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.

None yet

2 participants