Skip to content
Snippets Groups Projects
Commit 270b7063 authored by Björn Modée's avatar Björn Modée
Browse files

Fix server bug

parent 738dc04c
No related branches found
No related tags found
No related merge requests found
Pipeline #44687 failed
...@@ -6,6 +6,17 @@ import { useAppSelector } from '../../../../hooks' ...@@ -6,6 +6,17 @@ import { useAppSelector } from '../../../../hooks'
const CurrentUser: React.FC = () => { const CurrentUser: React.FC = () => {
const currentUser = useAppSelector((state: { user: { userInfo: any } }) => state.user.userInfo) const currentUser = useAppSelector((state: { user: { userInfo: any } }) => state.user.userInfo)
const roles = useAppSelector((state) => state.roles.roles)
const region = useAppSelector((state) => state.cities.cities)
const handleRole = (id: number) => {
return id
}
const handleRegion = (id: number) => {
return id
}
return ( return (
<div> <div>
<Box display="flex" flexDirection="column" alignContent="flex-start"> <Box display="flex" flexDirection="column" alignContent="flex-start">
...@@ -20,10 +31,10 @@ const CurrentUser: React.FC = () => { ...@@ -20,10 +31,10 @@ const CurrentUser: React.FC = () => {
</Typography> </Typography>
</div> </div>
<div> <div>
<Typography variant="h6">Region: {currentUser && currentUser.city && currentUser.city.name}</Typography> <Typography variant="h6">Region: {handleRegion(currentUser.city_id)}</Typography>
</div> </div>
<div> <div>
<Typography variant="h6">Roll: {currentUser && currentUser.role && currentUser.role.name}</Typography> <Typography variant="h6">Roll: {handleRole(currentUser.role_id)}</Typography>
</div> </div>
</Box> </Box>
</div> </div>
......
...@@ -50,7 +50,7 @@ For each function space, rust-code-analysis computes the list of metrics describ ...@@ -50,7 +50,7 @@ For each function space, rust-code-analysis computes the list of metrics describ
# Metrics # Metrics
Now the tool has analyzed the projekt and has outputted json files which the script will extrac the metrics from. Now the tool has analyzed the project and has outputted json files which the script will extract the metrics from.
Don't forget to change the path in the script. Don't forget to change the path in the script.
```bash ```bash
......
...@@ -66,10 +66,7 @@ class User(db.Model): ...@@ -66,10 +66,7 @@ class User(db.Model):
locked = db.Column(db.DateTime(timezone=True), nullable=True, default=None) locked = db.Column(db.DateTime(timezone=True), nullable=True, default=None)
role_id = db.Column(db.Integer, db.ForeignKey("role.id"), nullable=False) role_id = db.Column(db.Integer, db.ForeignKey("role.id"), nullable=False)
role_name = db.Column(db.Integer, db.ForeignKey("role.name"), nullable=False)
city_id = db.Column(db.Integer, db.ForeignKey("city.id"), nullable=False) city_id = db.Column(db.Integer, db.ForeignKey("city.id"), nullable=False)
city_name = db.Column(db.Integer, db.ForeignKey("city.name"), nullable=False)
media = db.relationship("Media", backref="upload_by") media = db.relationship("Media", backref="upload_by")
...@@ -77,9 +74,7 @@ class User(db.Model): ...@@ -77,9 +74,7 @@ class User(db.Model):
self._password = bcrypt.generate_password_hash(plaintext_password) self._password = bcrypt.generate_password_hash(plaintext_password)
self.email = email self.email = email
self.role_id = role_id self.role_id = role_id
self.role_name = role_name
self.city_id = city_id self.city_id = city_id
self.city_name = city_name
self.authenticated = False self.authenticated = False
self.name = name self.name = name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment