Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
AURA
tank
Commits
220aadb2
Commit
220aadb2
authored
Mar 19, 2020
by
Christian Pointner
Browse files
fix test cases
parent
e67001ee
Pipeline
#604
failed with stages
in 5 minutes and 14 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
store/files.go
View file @
220aadb2
...
...
@@ -181,7 +181,7 @@ func (st *Store) UpdateFileSourceHash(show string, id uint64, hash string) (*Fil
return
st
.
updateFile
(
show
,
id
,
"source__hash"
,
hash
)
}
func
(
st
*
Store
)
getFileUsage
(
id
uint64
,
playlists
[]
Playlist
)
(
err
error
)
{
func
(
st
*
Store
)
getFileUsage
(
id
uint64
,
playlists
*
[]
Playlist
)
(
err
error
)
{
sub
:=
st
.
db
.
Model
(
PlaylistEntry
{})
.
Select
(
"playlist_id"
)
.
Where
(
"file_id = ?"
,
id
)
.
Group
(
"playlist_id"
)
.
SubQuery
()
err
=
st
.
db
.
Where
(
"id in ?"
,
sub
)
.
Find
(
playlists
)
.
Error
return
...
...
@@ -197,7 +197,7 @@ func (st *Store) GetFileUsage(show string, id uint64) (playlists []Playlist, err
if
cnt
==
0
{
return
nil
,
ErrNotFound
}
err
=
st
.
getFileUsage
(
id
,
playlists
)
err
=
st
.
getFileUsage
(
id
,
&
playlists
)
return
}
...
...
@@ -208,7 +208,7 @@ func (st *Store) DeleteFile(show string, id uint64) (err error) {
if
err
=
result
.
Error
;
err
!=
nil
{
// we assume this is due to a FK constraint -> file in use by playlist_entry
usageErr
:=
&
ErrFileInUse
{}
if
err
=
st
.
getFileUsage
(
id
,
usageErr
.
Playlists
);
err
!=
nil
{
if
err
=
st
.
getFileUsage
(
id
,
&
usageErr
.
Playlists
);
err
!=
nil
{
return
}
return
usageErr
...
...
store/store_test.go
View file @
220aadb2
...
...
@@ -200,7 +200,7 @@ func TestMigrations(t *testing.T) {
// Shows
//
func
checkShows
(
t
*
testing
.
T
,
shows
Show
s
,
expected
[]
string
)
{
func
checkShows
(
t
*
testing
.
T
,
shows
[]
Show
,
expected
[]
string
)
{
// if len(shows) != len(expected) {
// t.Fatalf("expected %d shows in store but got %d: %v", len(expected), len(shows), shows)
// }
...
...
Write
Preview
Supports
Markdown
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