-
Notifications
You must be signed in to change notification settings - Fork 35
Add duration to topic_progress and recruit_project #726
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
base: develop
Are you sure you want to change the base?
Add duration to topic_progress and recruit_project #726
Conversation
…thub.com:Umuzi-org/Tilde into add_duration_to_topicProgress_and_recruitProject
|
|
||
| def get_duration_from_course_component(course_component): | ||
| if course_component.agile_card.status in [ | ||
| models.AgileCard.BLOCKED, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some things wont have cards. Expecting to have cards will mean they break some of the time.
Just use the times. We dont need to query the database for related objects.
Here is the code:
def get_duration(self):
if self.start_time == None:
return timedelta(0)
if self.end_time == None:
return timezone.now() - self.start_time
eturn self.end_time - self.start_time
Notice the use of self. And the name of the function. These are intentional.
| return self.agile_card.status | ||
|
|
||
| def get_duration(self): | ||
| return helpers.get_duration_from_course_component(self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather make a base class and inherit the functionality.
| class get_duration_Tests(TestCase): | ||
|
|
||
| def make_project_card(self, status): | ||
| self.card = factories.AgileCardFactory( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this getting complicated again?
Why are cards here at all?
Write loosely coupled code. Dont write code that relied on things it doesn't need. This stuff will break.
Related issues: [please specify]
Description:
What are you up to? Fill us in :)
Screenshots/videos
I solemnly swear that: