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

Fix part of #137: Added story-progress in Topic-Play-Tab #262

Merged
merged 4 commits into from
Oct 29, 2019

Conversation

rt4914
Copy link
Contributor

@rt4914 rt4914 commented Oct 24, 2019

Explanation

This PR is in continuation with #260 and implements the story-progress in topic-play-tab.

To test this functionality make following changes:

  1. Make TopicActivity as launcher activity.
  2. TopicActivity should show TopicPlayFragment instead of TopicFragment. (Do this change in TopicActivityPresenter)

Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The PR explanation includes the words "Fixes #bugnum: ..." (or "Fixes part of #bugnum" if the PR only partially fixes an issue).
  • The PR follows the style guide.
  • The PR does not contain any unnecessary auto-generated code from Android Studio.
  • The PR is made from a branch that's not called "develop".
  • The PR is assigned to an appropriate reviewer.

}
.size

val storyProgressPercentage: Int = (completedChapterCount / totalChapterCount) * 100
Copy link
Contributor

Choose a reason for hiding this comment

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

nit change: Please remove explicit type specifications

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here we need this type to make sure that the result of right-side is always in integer.

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Will this division work correctly? It seems like an int divided by an int--won't this always result in 0? I think you need to convert to a float somewhere before converting back to int for display.

Copy link
Contributor

@nikitamarysolomanpvt nikitamarysolomanpvt left a comment

Choose a reason for hiding this comment

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

Some nit changes and test case failing PTAL

Copy link
Contributor

@veena14cs veena14cs left a comment

Choose a reason for hiding this comment

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

Generally LGTM please check test case.

@nikitamarysolomanpvt nikitamarysolomanpvt removed their assignment Oct 25, 2019
Copy link
Contributor

@veena14cs veena14cs left a comment

Choose a reason for hiding this comment

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

Looks good.

@veena14cs veena14cs removed their assignment Oct 26, 2019
Copy link
Sponsor Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Thanks @rt4914. Approach LGTM, but I think there's one bug that needs to be addressed here.

}
.size

val storyProgressPercentage: Int = (completedChapterCount / totalChapterCount) * 100
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Will this division work correctly? It seems like an int divided by an int--won't this always result in 0? I think you need to convert to a float somewhere before converting back to int for display.

app/src/main/res/layout/topic_play_story_summary.xml Outdated Show resolved Hide resolved
@BenHenning BenHenning assigned rt4914 and unassigned BenHenning Oct 29, 2019
@rt4914
Copy link
Contributor Author

rt4914 commented Oct 29, 2019

#262 (comment)

The progress percentage calculation was incorrect as rightly pointed out by @BenHenning. I identified this issue when I was working on Expandable List and solved it there and missed on fixing that in this PR. Fixing it now.

@rt4914 rt4914 merged commit 2fd84ba into develop Oct 29, 2019
@rt4914 rt4914 deleted the topic-play-low-fi-story-progress branch October 29, 2019 09:04
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.

None yet

4 participants