Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
tank
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
tank
Commits
220aadb2
Commit
220aadb2
authored
5 years ago
by
Christian Pointner
Browse files
Options
Downloads
Patches
Plain Diff
fix test cases
parent
e67001ee
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
store/files.go
+3
-3
3 additions, 3 deletions
store/files.go
store/store_test.go
+1
-1
1 addition, 1 deletion
store/store_test.go
with
4 additions
and
4 deletions
store/files.go
+
3
−
3
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
...
...
This diff is collapsed.
Click to expand it.
store/store_test.go
+
1
−
1
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)
// }
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment