Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
githubering182 committed Aug 21, 2024
1 parent be57fd5 commit 314e3aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions backend-app/project/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ class Meta:
def get_project(self, instance: ProjectGoal) -> int: return instance.project.id

def get_attribute(self, instance: ProjectGoal) -> str:
level_name = instance.attribute.level.name
return f"{level_name}: {instance.attribute.name}"
make_name = lambda a: f"{a.name}({a.level.name})"

attribute = instance.attribute
parent = attribute.parent

return (f"{make_name(parent)}: " if parent else "") + make_name(attribute)

def get_complete(self, instance: ProjectGoal) -> int:
return instance.attribute.attributegroup_set.count()
2 changes: 1 addition & 1 deletion frontend-app/src/components/common/GoalCard/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "./styles.css";
*/
export default function GoalCard({ goalItem, onDelete }) {
const { attribute, amount, complete, id } = goalItem;
const progress = Math.min(Math.ceil(complete / amount * 100));
const progress = Math.min(100, Math.ceil(complete / amount * 100));

return <article className="goal__card">
<h3>{attribute}</h3>
Expand Down

0 comments on commit 314e3aa

Please sign in to comment.