Skip to content

Commit

Permalink
Groupfixes (#254)
Browse files Browse the repository at this point in the history
* fix group wrong num error

* dries fix

---------

Co-authored-by: Xander Bil <[email protected]>
  • Loading branch information
DRIESASTER and xerbalind authored May 23, 2024
1 parent dea50b8 commit 1efaf42
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion backend/src/group/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from sqlalchemy import Column, ForeignKey, Table, ForeignKeyConstraint, Integer, event, select, func
from sqlalchemy import Column, ForeignKey, Table, event, select, func
from sqlalchemy.orm import Mapped, mapped_column, relationship
from src.database import Base
from typing import List
Expand Down
2 changes: 1 addition & 1 deletion backend/src/group/schemas.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Sequence

from pydantic import BaseModel, ConfigDict, Field
from pydantic import BaseModel, ConfigDict
from src.user.schemas import User


Expand Down
16 changes: 11 additions & 5 deletions backend/src/group/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
from . import schemas
from .models import Group, StudentGroup

from collections import defaultdict
import asyncio

locks = defaultdict(asyncio.Lock)


async def get_group_by_id(db: AsyncSession, group_id: int) -> Group | None:
return (await db.execute(select(Group).filter_by(id=group_id))).unique().scalar_one_or_none()
Expand All @@ -31,11 +36,12 @@ async def get_groups_by_user(db: AsyncSession, user_id: str) -> Sequence[Group]:


async def create_group(db: AsyncSession, group: schemas.GroupCreate) -> Group:
db_group = Group(**group.model_dump())
db.add(db_group)
await db.commit()
await db.refresh(db_group)
return db_group
async with locks[group.project_id]:
db_group = Group(**group.model_dump())
db.add(db_group)
await db.commit()
await db.refresh(db_group)
return db_group


async def join_group(db: AsyncSession, team_id: int, user_id: str):
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/components/project/RadiobuttonList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ watch(isToggled, (newVal) => {
}
});
watch(selectedOption, (newVal) => {
emit("update:selectedOption", newVal);
});
function handleDateChange(value: Date) {
emit("update:date", value);
}
Expand Down

0 comments on commit 1efaf42

Please sign in to comment.