Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cbdiscord
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Geovanny E. Vera Pazmino
cbdiscord
Commits
541ddfa2
Commit
541ddfa2
authored
Apr 17, 2020
by
Geovanny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added checkers when there is no rows in the DB
parent
bcdaeacd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
1 deletion
+4
-1
manager.py
discord/unit/manager.py
+1
-1
route.js
server/user/route.js
+3
-0
No files found.
discord/unit/manager.py
View file @
541ddfa2
...
@@ -117,7 +117,7 @@ class UnitManager(commands.Cog):
...
@@ -117,7 +117,7 @@ class UnitManager(commands.Cog):
"""Gets all units"""
"""Gets all units"""
data
=
await
Api
.
get
(
'/unit/all'
)
data
=
await
Api
.
get
(
'/unit/all'
)
if
data
==
None
:
if
(
data
==
None
or
len
(
data
[
'units'
])
==
0
)
:
return
await
ctx
.
send
(
'No units found'
)
return
await
ctx
.
send
(
'No units found'
)
units_data
=
[]
units_data
=
[]
...
...
server/user/route.js
View file @
541ddfa2
...
@@ -38,6 +38,9 @@ router.get('/units', async (context, next) => {
...
@@ -38,6 +38,9 @@ router.get('/units', async (context, next) => {
checkUser
(
context
);
checkUser
(
context
);
try
{
try
{
const
data
=
await
userModel
.
getUserUnits
(
context
.
session
.
user_id
);
const
data
=
await
userModel
.
getUserUnits
(
context
.
session
.
user_id
);
if
(
data
.
length
===
1
&&
data
[
0
].
id
===
null
){
throw
Error
(
'No Units Found'
)
}
context
.
response
.
body
=
{
units
:
data
};
context
.
response
.
body
=
{
units
:
data
};
context
.
status
=
200
;
context
.
status
=
200
;
}
catch
(
error
){
}
catch
(
error
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment