Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nghyd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Cassiopée
nghyd
Commits
117f1d12
Commit
117f1d12
authored
2 years ago
by
François Grand
Browse files
Options
Downloads
Patches
Plain Diff
refactor : do not create a Nub to get results units
refs
#590
parent
3d6323b8
No related branches found
No related tags found
2 merge requests
!225
Release v4.17.0
,
!195
Resolve "Optimiser l'affichage des unités"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/services/formulaire.service.ts
+4
-11
4 additions, 11 deletions
src/app/services/formulaire.service.ts
with
4 additions
and
11 deletions
src/app/services/formulaire.service.ts
+
4
−
11
View file @
117f1d12
...
...
@@ -58,6 +58,7 @@ import { FormulaireEspece } from "../formulaire/definition/form-espece";
import
{
FormulairePrebarrage
}
from
"
../formulaire/definition/form-prebarrage
"
;
import
{
ServiceFactory
}
from
"
./service-factory
"
;
import
{
FormulairePressureLoss
}
from
"
app/formulaire/definition/form-pressureloss
"
;
import
{
getNubResultUnit
}
from
"
jalhyd
"
;
@
Injectable
()
export
class
FormulaireService
extends
Observable
{
...
...
@@ -194,7 +195,7 @@ export class FormulaireService extends Observable {
* Returns variable name and unit from symbol
* @param calcType
* @param symbol
* @param forceUnit if given, will be used as
n
uit
* @param forceUnit if given, will be used as u
n
it
*/
public
expandVariableNameAndUnit
(
calcType
:
CalculatorType
,
symbol
:
string
,
forceUnit
?:
string
):
string
{
let
s
=
this
.
expandVariableName
(
calcType
,
symbol
);
...
...
@@ -217,16 +218,8 @@ export class FormulaireService extends Observable {
if
(
forceUnit
)
{
unit
=
forceUnit
;
}
else
{
// create dummy Nub from CalcType just to get results units
let
dummyNub
:
Nub
;
try
{
dummyNub
=
Session
.
getInstance
().
createNub
(
new
Props
({
"
calcType
"
:
calcType
}));
}
catch
(
e
)
{
// silent fail
}
if
(
dummyNub
?.
resultsUnits
&&
dummyNub
.
resultsUnits
[
symbol
])
{
unit
=
dummyNub
.
resultsUnits
[
symbol
];
}
else
{
unit
=
getNubResultUnit
(
calcType
,
symbol
);
if
(
unit
===
undefined
)
{
// last chance: if unit cannot be read in model, use translation files
const
unitKey
=
"
UNIT_
"
+
symbolBase
;
if
(
langCache
&&
langCache
[
unitKey
]
!==
undefined
)
{
...
...
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