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

View Skipped Days In The Bar Chart #1736

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

Mahmoud-Ibrahim-750
Copy link

I noticed that the skipped days appear in the history chart but not in the bar chart so I modified the code adding a piece of code to pass the skipped days data from the database to the view and drawing a bar with a slightly transparent colour -to let it be different from the main column- accordingly.

Mahmoud-Ibrahim-750 and others added 3 commits June 11, 2023 10:19
I noticed that the skipped days appear in the history chart but not in the bar chart so I modified the code adding a piece of code to pass the skipped days data from database to the view and drawing a bar with a slightly transparent color -to let it be different from the main column- accordingly.
Updated the tests to provide the data for skipped entries too.

init {
component.axis = axis
component.series.add(series1)
component.skippedSeries.add(series2)
Copy link
Collaborator

Choose a reason for hiding this comment

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

How come the test setup seems to change, but the assertions (the .png) do not? Are they just close enough such that the tests pass anyway, and should they be updated instead? What am I missing?

Choose a reason for hiding this comment

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

After running the test multiple times with different cases, here is a final conclusion:
First, the test mechanism seems to ignore little differences between the expected image and the actual one, so yes, they are close enough such that the test pass as long as the difference value is less than 1.
Second, I think the test mechanism should be updated to take care of little difference, then according to that update, the expected image should be updated too. We may update it for now until we take care of the test in a different PR.

Here are some of the results I got from the test, feel free to try them on your own (each test case is provided with the difference value and the output image too):

  1. the current expected image (the one we may update later):
    [Imgur]

  2. the current test data (with skipped days):
    [Imgur](current test data with skipped days)
    [Imgur](output)
    [Imgur](difference)

  3. the current test data (without skipped days):
    [Imgur](current test data without skipped days)
    [Imgur](output)
    [Imgur](difference)

  4. a modified test data (accepted):
    [Imgur](accepted modified test data)
    [Imgur](output)
    [Imgur](difference)

  5. a modified test data (rejected):
    [Imgur](rejected modified test data)
    [Imgur](output)
    [Imgur](difference)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's better to update the expected images in the same PR, following https://github.com/iSoron/uhabits/blob/dev/docs/TEST.md#running-instrumented-tests, but you can also wait for @iSoron to chime in if you prefer.

Choose a reason for hiding this comment

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

It's ok to wait. Updating the image takes no time anyway, So there's no need to rush.

Copy link
Author

@Mahmoud-Ibrahim-750 Mahmoud-Ibrahim-750 Dec 2, 2023

Choose a reason for hiding this comment

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

@iSoron, Would you check this PR so we can proceed and finally merge it? especially before you merge #1884?

Copy link
Author

Choose a reason for hiding this comment

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

@hiqua Hey there! how are you doing? I hope you're fine. I just wanted to tell you that I will update the test image and request you to review this PR so we can finally merge it.

Copy link
Author

Choose a reason for hiding this comment

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

@hiqua Test image is up-to-date and this PR is ready for a final review.

I updated the expected image in the test to take into account the skipped days as well as the completed days. I also changed the test input in BarChartTest.kt to let it better represent possible cases.
@Mahmoud-Ibrahim-750 Mahmoud-Ibrahim-750 marked this pull request as ready for review December 5, 2023 15:03
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.

2 participants