Skip to content

Alexiane genealogy#325

Open
alexianelaude wants to merge 4 commits intoMines-Paristech-Students:masterfrom
alexianelaude:alexiane-genealogy
Open

Alexiane genealogy#325
alexianelaude wants to merge 4 commits intoMines-Paristech-Students:masterfrom
alexianelaude:alexiane-genealogy

Conversation

@alexianelaude
Copy link
Contributor

@alexianelaude alexianelaude commented Apr 1, 2022

  • Find closest parent and display relation tree (pretty ugly for now...)

Screenshot 2022-04-01 at 4 59 16 PM

TODO: make this display prettier? (with an actual tree) + should we include the roommate relationship?

@delmaass delmaass requested a review from abocquet April 1, 2022 13:46
Copy link
Member

@abocquet abocquet left a comment

Choose a reason for hiding this comment

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

Thank you for this addition, it will be useful!

This PR is a bit long, generally we try to keep them under 150 lines (sometimes more if there is UI). To have more precise feedback, could you split your PR please? Suggestion:
1/ introducing the AST in the model + basic view (profile, ...)
2/ declare the /genealogy views in the backend with the more advanced functionnalities
3/ add the frontend
I'll give you feedback ASAP each time so you can move forward.

We try to keep the whole repo in english and avoid "frenglish", as it leads to confusion. In this regard, ast_cousin would be fit than 'cousinast'. For "minesparent" it's a pun with the "godparent" word.

In order to make the pipelines pass, you should reformat your code with "black" (https://github.com/psf/black), you can either reformat the whole codebase with it at once or reformat files as you save them (there is a PyCharm extension). This is important so there never are changes linked to formatting in PR reviews, which is very noisy for nothing.

You did a great job, the few comments should be quick to fix 👍

result = []
recherche = False
result_string = ""
return Response({'eleves': eleves, 'result': result, 'result_string': result_string, 'recherche': recherche})
Copy link
Member

Choose a reason for hiding this comment

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

we probably want to avoid returning the list of all students at once, especially if there is search in the request

result_string = ""
return Response({'eleves': eleves, 'result': result, 'result_string': result_string, 'recherche': recherche})

def post(self, request):
Copy link
Member

Choose a reason for hiding this comment

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

If it gives an information and does not modify anything, if should be a GETmethod. In api/users.ts, having getGenealogy calling api.post is a bit weird. Instead you can simply declare a new path with a direct method, and you'll spare the dedicated APIView

return set(Role.objects.filter(query).values_list("association__pk", flat=True))

def get_absolute_url(self):
return '/profils/'+self.id
Copy link
Member

Choose a reason for hiding this comment

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

I don't see this function called anywhere

@staticmethod
def BFS(start, end):
"""Breadth-First-Search algorithm, to find the shortest path between two students"""
visited = []
Copy link
Member

Choose a reason for hiding this comment

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

using a set will provide O(log n) complexity vs O(n) with a plain array in the in in line 242

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