Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWK Project Effort Estimation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
oh14.dev
SWK Project Effort Estimation
Commits
8baa1b6f
Commit
8baa1b6f
authored
4 years ago
by
Jonas Zohren
Browse files
Options
Downloads
Patches
Plain Diff
round to two digits while displaying numbers
parent
75a9060c
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#15629
passed
4 years ago
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/RowWorkItem.svelte
+5
-5
5 additions, 5 deletions
src/RowWorkItem.svelte
src/SumRow.svelte
+4
-4
4 additions, 4 deletions
src/SumRow.svelte
src/utils.ts
+3
-3
3 additions, 3 deletions
src/utils.ts
with
12 additions
and
12 deletions
src/RowWorkItem.svelte
+
5
−
5
View file @
8baa1b6f
<script
lang=
"ts"
>
import
{
calculateE
,
calculateS
,
calculateV
}
from
"
./estimator
"
;
import
{
round
One
}
from
"
./utils
"
;
import
{
round
Two
}
from
"
./utils
"
;
export
let
a
:
number
export
let
b
:
number
...
...
@@ -27,8 +27,8 @@
<td
class=
"tg-0lax"
>
<input
type=
"number"
class=
"c-input"
bind:value=
"
{
b
}
"
>
</td>
<td
class=
"tg-0lax"
>
{
hideNull
(
round
One
(
E
))
}
</td>
<td
class=
"tg-0lax"
>
{
hideNull
(
round
One
(
S
))
}
</td>
<td
class=
"tg-0lax"
>
{
hideNull
(
round
One
(
SEPercent
))
}
%
</td>
<td
class=
"tg-0lax"
>
{
hideNull
(
round
One
(
V
))
}
</td>
<td
class=
"tg-0lax"
>
{
hideNull
(
round
Two
(
E
))
}
</td>
<td
class=
"tg-0lax"
>
{
hideNull
(
round
Two
(
S
))
}
</td>
<td
class=
"tg-0lax"
>
{
hideNull
(
round
Two
(
SEPercent
))
}
%
</td>
<td
class=
"tg-0lax"
>
{
hideNull
(
round
Two
(
V
))
}
</td>
</tr>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/SumRow.svelte
+
4
−
4
View file @
8baa1b6f
<script
lang=
"ts"
>
import
type
{
WorkPackage
}
from
"
./estimator
"
;
import
{
calculateSSum
,
calculateESum
,
calculateVSum
}
from
'
./estimator
'
;
import
{
round
One
,
sumIgnoreNonNumbers
}
from
"
./utils
"
;
import
{
round
Two
,
sumIgnoreNonNumbers
}
from
"
./utils
"
;
export
let
workPackages
:
WorkPackage
[]
export
let
r
:
number
=
NaN
;
...
...
@@ -18,14 +18,14 @@
∑
{
sumIgnoreNonNumbers
(
workPackages
.
map
(
workPackage
=>
workPackage
.
b
))
}
</td>
<td
class=
"tg-0lax"
>
∑
{
round
One
(
calculateESum
(
workPackages
,
r
))
}
∑
{
round
Two
(
calculateESum
(
workPackages
,
r
))
}
</td>
<td
class=
"tg-0lax"
>
{
round
One
(
calculateSSum
(
workPackages
,
u
))
}
{
round
Two
(
calculateSSum
(
workPackages
,
u
))
}
</td>
<td
class=
"tg-0lax"
>
</td>
<td
class=
"tg-0lax"
>
∑
{
round
One
(
calculateVSum
(
workPackages
,
u
))
}
∑
{
round
Two
(
calculateVSum
(
workPackages
,
u
))
}
</td>
</tr>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/utils.ts
+
3
−
3
View file @
8baa1b6f
/**
* Rounds a number to
one
digit after the period dot or null, if the input is not a number
* Rounds a number to
two
digit
s
after the period dot or null, if the input is not a number
* @param n number to round
*/
export
function
round
One
(
n
:
number
):
number
|
null
{
export
function
round
Two
(
n
:
number
):
number
|
null
{
if
(
typeof
n
===
"
number
"
&&
!
isNaN
(
n
))
{
return
Math
.
round
(
n
*
Math
.
pow
(
10
,
1
))
/
Math
.
pow
(
10
,
1
);
return
Math
.
round
(
n
*
Math
.
pow
(
10
,
2
))
/
Math
.
pow
(
10
,
2
);
}
else
{
return
null
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment