Details

    • Type: Task
    • Status: Done
    • Priority: L3 - Default
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.1.0-alpha2, 2.1.0
    • Component/s: frontend
    • Labels:
      None

      Description

      Currently we have multiple places where we need to parse numbers from inputs and check if these are correct, whereas the logic repeats in each component. We need this logic to be extracted in a separate service and consistently used where needed.

      AT:

      • We have a module which parses a number from a string and checks if it is correct.
      • The module is used in
        • Target value modal
        • Numeric variable filter
        • Duration filter

        Issue Links

          Activity

          Hide
          johannes.heinemann Johannes Heinemann added a comment -

          Review hints:

          • I like that we refactor this
          • numberParser.js#isValidNumber: the function isValidNumber is never used outside the file itself, so there is no need to export it
          • numberParser.js#isValidNumber: every valid integer is always a valid float. Therfore, you can directly call from the function isPositiveNumber the isFloatNumber function.
          • numberParser.js#isPositiveNumber: I would rename the function to{{isPositiveFloatNumber}}, because the is more specific what this function is actually checking for.
          • numberParser.js: there are no test that ensure the correct behavior of this class
          • numberParser.js#isFloatNumber: As far as I know is 123. also a valid float number, but is not recognized by that as a valid number.
          • TargetValueModal.test.js: in line 5 there is a commented out import statement that should be removed
          Show
          johannes.heinemann Johannes Heinemann added a comment - Review hints: I like that we refactor this numberParser.js#isValidNumber: the function isValidNumber is never used outside the file itself, so there is no need to export it numberParser.js#isValidNumber: every valid integer is always a valid float. Therfore, you can directly call from the function isPositiveNumber the isFloatNumber function. numberParser.js#isPositiveNumber: I would rename the function to{{isPositiveFloatNumber}}, because the is more specific what this function is actually checking for. numberParser.js: there are no test that ensure the correct behavior of this class numberParser.js#isFloatNumber: As far as I know is 123. also a valid float number, but is not recognized by that as a valid number. TargetValueModal.test.js: in line 5 there is a commented out import statement that should be removed
          Hide
          johannes.heinemann Johannes Heinemann added a comment -

          Review hint:

          • client/src/modules/services/index.js: you commented out two lines? Do we still need them? If no remove them.
          Show
          johannes.heinemann Johannes Heinemann added a comment - Review hint: client/src/modules/services/index.js: you commented out two lines? Do we still need them? If no remove them.

            People

            • Assignee:
              Unassigned
              Reporter:
              kyrylo.zakurdaiev Kyrylo Zakurdaiev
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: