Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasSchaeuble-EH committed Oct 29, 2023
2 parents d601ed9 + e6a61b0 commit 7a4ba10
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
6 changes: 4 additions & 2 deletions backend/main.py
@@ -1,4 +1,5 @@


import lunchheros

from fastapi.encoders import jsonable_encoder
from src.lunchheros.db.dbFetcher import get_encoded_data
Expand Down Expand Up @@ -28,6 +29,7 @@ def load_current_user(userId):
def load_current_user(userId: str):
userData = getUserWithId(userId)
queryList = getAllQueryListData()
#test = get_encoded_data(1,1,userData)

test = lunchheros.match.match(userData)

return { "currentUser" : userData, "query": queryList}
5 changes: 4 additions & 1 deletion backend/src/__init__.py
@@ -1 +1,4 @@
"""Lunchheros: Backend to match people for lunch based on their interests."""
"""Lunchheros: Backend to match people for lunch based on their interests."""
from lunchheros import match

__all__ = ["match"]
4 changes: 4 additions & 0 deletions backend/src/lunchheros/match/__init__.py
@@ -1 +1,5 @@
"""Subpackage related to matching between users into groups."""

from lunchheros.match import matching

__all__ = ["matching"]
14 changes: 14 additions & 0 deletions backend/src/lunchheros/match/_randomize.py
@@ -1,5 +1,7 @@
import random

from lunchheros.db.dbFetcher import parse_user_id_tolist


def _randomize_groups(group_size: int, users: list[str]) -> list[list]:
"""Randomize the groups of users.
Expand Down Expand Up @@ -37,4 +39,16 @@ def _randomize_groups(group_size: int, users: list[str]) -> list[list]:
return groups


def match(userids):

# convert userids to list
userids = parse_user_id_tolist(userids)
# group size
groupsize = 5
# randomize the groups
groups = _randomize_groups(groupsize, userids)
# return the groups
return groups



0 comments on commit 7a4ba10

Please sign in to comment.