Skip to content

Feature accurate hour display#20

Merged
kbeker merged 6 commits intomasterfrom
feature-accurate-hour-display
Mar 28, 2019
Merged

Feature accurate hour display#20
kbeker merged 6 commits intomasterfrom
feature-accurate-hour-display

Conversation

@maciejSamerdak
Copy link
Collaborator

@maciejSamerdak maciejSamerdak commented Jan 28, 2019

Resolves #46

Related #106

@maciejSamerdak maciejSamerdak force-pushed the feature-complex-description-input branch from f150332 to 78183f6 Compare February 5, 2019 13:03
@maciejSamerdak maciejSamerdak force-pushed the feature-accurate-hour-display branch from 1b8b92a to 4bf6d9e Compare February 5, 2019 13:05
kbeker
kbeker previously approved these changes Feb 6, 2019
Copy link
Contributor

@kbeker kbeker left a comment

Choose a reason for hiding this comment

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

Please apply changes and for me OK

)

def to_representation(self, instance):
data = super(ReportSerializer, self).to_representation(instance)
Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I know in python3 you don't have to write super(Class, self). super() should be enough

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've seen it around the web. Thought that maybe it's some sort of good practise, like explicit parametrising in function calls.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

def to_representation(self, instance):
data = super(ReportSerializer, self).to_representation(instance)
# SELF NOTE: For some reason, tests for list get methods got a Queryset as instance in serializer and I dunno why...
if type(self.instance) is Report:
Copy link
Contributor

Choose a reason for hiding this comment

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

change it to

if isinstance(self.instance, Report):

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done


def to_representation(self, instance):
data = super(ReportSerializer, self).to_representation(instance)
# SELF NOTE: For some reason, tests for list get methods got a Queryset as instance in serializer and I dunno why...
Copy link
Contributor

Choose a reason for hiding this comment

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

Add it as a issue and in have to be investigate later. After adding issue please delete comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@maciejSamerdak maciejSamerdak force-pushed the feature-complex-description-input branch from 78183f6 to 9d0c9b3 Compare February 25, 2019 15:09
@maciejSamerdak maciejSamerdak force-pushed the feature-accurate-hour-display branch from 802317d to 620bd5b Compare February 25, 2019 15:35
@maciejSamerdak maciejSamerdak force-pushed the feature-complex-description-input branch from 9d0c9b3 to 8db2993 Compare February 26, 2019 13:34
@maciejSamerdak maciejSamerdak force-pushed the feature-accurate-hour-display branch from 942cd4b to 3386a7d Compare February 26, 2019 13:35
@maciejSamerdak maciejSamerdak added this to the tag 0.1.0 milestone Mar 4, 2019
@maciejSamerdak maciejSamerdak force-pushed the feature-accurate-hour-display branch from 3386a7d to 78535dd Compare March 20, 2019 16:22
@maciejSamerdak maciejSamerdak force-pushed the feature-complex-description-input branch 2 times, most recently from f6fa52a to da2a61a Compare March 22, 2019 14:33
@maciejSamerdak maciejSamerdak force-pushed the feature-accurate-hour-display branch 2 times, most recently from 693846b to 1af60a5 Compare March 28, 2019 14:58
@maciejSamerdak maciejSamerdak force-pushed the feature-complex-description-input branch from da2a61a to b6b32a5 Compare March 28, 2019 14:58
@maciejSamerdak maciejSamerdak changed the base branch from feature-complex-description-input to master March 28, 2019 15:06
@maciejSamerdak maciejSamerdak changed the base branch from master to feature-complex-description-input March 28, 2019 15:07
@maciejSamerdak maciejSamerdak changed the base branch from feature-complex-description-input to master March 28, 2019 15:40
kbeker
kbeker previously approved these changes Mar 28, 2019
@maciejSamerdak maciejSamerdak force-pushed the feature-accurate-hour-display branch 2 times, most recently from 180bb5d to 409cb70 Compare March 28, 2019 16:21
Adds method returning report's work hours value to string with propper
formatting.

The method has @Property tag included for easier access through HTML
templates. The method is thus treated as a read-only field rather than a
function.
Replaced `work_hours` with `work_hours_str` for accurate time display format.
Adds custom field derived from `DecimalField` with overriden
`to_internal_value` method. If field input contains *:* symbol, it will
be converted to a *.* symbol before being processed through validation.
Overrides `to_representation` method in serializer in a way, that allows
displaying work hours value in proper format.
Supply custom messages to display hour in proper format in validation
error messages.
@kbeker kbeker force-pushed the feature-accurate-hour-display branch from 409cb70 to 1aa1e00 Compare March 28, 2019 16:27
Copy link
Contributor

@kbeker kbeker left a comment

Choose a reason for hiding this comment

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

Ready to merge

@kbeker kbeker merged commit 1aa1e00 into master Mar 28, 2019
@kbeker kbeker deleted the feature-accurate-hour-display branch March 28, 2019 16:28
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