Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-77042

Database: 0 is not shown on number field (both single view and list view)

XMLWordPrintable

    • MOODLE_401_STABLE, MOODLE_402_STABLE
    • MOODLE_401_STABLE
    • MDL-77042-401
    • Hide
      1. Log in as admin
      2. Create a course
      3. Add a Database activity
      4. Add a Short text field
      5. Add a Number field
        • Name = Test
        • Required field = No
      6. Add three entries to the database (fill in the short text field for each)
        • Test: 1
        • Test: 0
        • Test: <empty string>
      7. View the list of database entries
      8. Confirm the first entry displays the value 1 for the Test field
      9. Confirm the second entry displays the value 0 for the Test field
      10. Confirm the third entry displays nothing for the Test field
      Show
      Log in as admin Create a course Add a Database activity Add a Short text field Add a Number field Name = Test Required field = No Add three entries to the database (fill in the short text field for each) Test: 1 Test: 0 Test: <empty string> View the list of database entries Confirm the first entry displays the value 1 for the Test field Confirm the second entry displays the value 0 for the Test field Confirm the third entry displays nothing for the Test field

      Hi,

      If you introduce a 0 on a number field on a database, it is saved but it is not shown afterwards.

      • When I edit the entry I see the 0 so I assume it is correctly saved.
      • When I see the entry I don't see the 0. I checked the page source and used the inspect and it is not there.

      In case it is useful

      • If the number is different from 0

        <div class="col-4 col-lg-3 font-weight-bold">Number</div>
        <div class="col-8 col-lg-9 ml-n3">2</div>
        

      • If the number is 0

        <div class="col-4 col-lg-3 font-weight-bold">Number</div>
        <div class="col-8 col-lg-9 ml-n3"></div>
        

      To reproduce it

      1. Add a database on a >=4.1 Moodle site 1
      2. Add a number field (only this is necessary fill free to add more fields and/or make them required fields)
      3. Add a template
      4. Add entry with any user, type a number different from 0 and save it
      5. Check that you can see the entry and that the browser shows the number correctly
      6. Add entry with any user, type a 0 and save it
      7. Check that you can see the entry but that the 0 is not shown

      1 I found it on a Moodle 4.2dev (Build: 20230120) and I cannot reproduce on a Moodle 4.0.5 (Build: 20221114) (MoodleCloud). So I am assuming this is related to changes on database on 4.1. I could be wrong and be a more recent change and only affects 4.2 versions

      What I expected?
      The browser to show the 0

      Thanks for your time!
      Isabel

        1. 401.gif
          401.gif
          350 kB
        2. master.gif
          master.gif
          185 kB

            pholden Paul Holden
            isabelrenedo Isabel Renedo Rouco
            Carlos Escobedo Carlos Escobedo
            Ferran Recio Ferran Recio
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 45 minutes
                1h 45m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.