Skip to content

Commit

Permalink
cosmetic
Browse files Browse the repository at this point in the history
  • Loading branch information
teticio committed Sep 16, 2021
1 parent a72a56d commit 8f2e859
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def update_playlist_id(playlist: schemas.PlaylistId,

@app.post('/api/v1/update_playlist_uploads')
def update_playlist_uploads(playlist: schemas.PlaylistUploads,
db: Session = Depends(get_db)):
db: Session = Depends(get_db)):
"""Update number of times playlist has been uploaded to Spotify.
Args:
Expand Down
1 change: 1 addition & 0 deletions migrate_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)


def copy_objects(db_from, db_to, cls):
"""Copy all items in a table from one databse to another.
Expand Down
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function App() {
setPlaylist(playlist);
navigate('/playlist');
}}
onSettings={(waypoints) => {
onSettings={waypoints => {
setWaypoints(waypoints);
navigate('/settings');
}}
Expand Down
2 changes: 1 addition & 1 deletion src/components/AddTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function AddTrack({ numTracks = 0, spotify = null, onAdd = f => f
<div className='d-flex align-items-center'>
<TrackSelector
spotify={spotify}
onSelect={(id) => setCurrentId(id)}
onSelect={id => setCurrentId(id)}
onSearch={() => {
setSearches(searches => {
if (searches + 1 !== 0) setSpinner(true);
Expand Down
4 changes: 2 additions & 2 deletions src/components/CreatePlaylist.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ export default function CreatePlaylist({
<AddTrack
numTracks={_waypoints.track_ids.length}
spotify={spotify}
onAdd={(id) => {
onAdd={id => {
setWaypoints({ 'track_ids': _waypoints.track_ids.concat(id) });
}} />
<VerticalSpacer px={10} />
<Card>
<Card.Body>
<RemovablePlaylist {..._waypoints} onRemove={(id) => {
<RemovablePlaylist {..._waypoints} onRemove={id => {
setWaypoints({ 'track_ids': _waypoints.track_ids.filter((element, index) => index !== id) });
}} />
{_waypoints.track_ids.length > 0 ?
Expand Down
2 changes: 1 addition & 1 deletion src/components/LatestPlaylists.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function LatestPlaylists({ spotify }) {

useEffect(() => {
getLatestPlaylists(topN)
.then((playlists) => {
.then(playlists => {
setPlaylists(playlists);
}).catch(error => console.error('Error:', error));
}, [topN]);
Expand Down
2 changes: 1 addition & 1 deletion src/components/MostUploadedPlaylists.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function MostUploadedPlaylists({ spotify }) {

useEffect(() => {
getMostUploadedPlaylists(topN)
.then((playlists) => {
.then(playlists => {
setPlaylists(playlists);
}).catch(error => console.error('Error:', error));
}, [topN]);
Expand Down
2 changes: 1 addition & 1 deletion src/components/RemovablePlaylist.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function RemovablePlaylist({ track_ids = [], onRemove = f => f })
key={i}
track_id={track_id}
uuid={i}
onRemove={(uuid) => onRemove(uuid)}
onRemove={uuid => onRemove(uuid)}
/>
</div>
))}
Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchPlaylists.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function SearchPlaylists({ spotify }) {
setPlaylists([]);
} else {
searchPlaylists(actualSearchString, topN)
.then((playlists) => {
.then(playlists => {
setPlaylists(playlists);
}).catch(error => console.error('Error:', error));
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Settings({ size, creativity, noise, onChange = f => f, o
const [_size, setSize] = useState(size);
const [_creativity, setCreativity] = useState(creativity);
const [_noise, setNoise] = useState(noise);
const setValidSize = (size) => setSize(Math.max(Math.min(size, 100), 1))
const setValidSize = size => setSize(Math.max(Math.min(size, 100), 1))
const update = () => onChange(_size, _creativity, _noise);

useEffect(() => () => update());
Expand Down
17 changes: 10 additions & 7 deletions src/components/ShowPlaylist.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,16 @@ export default function ShowPlaylist({ playlist, onClose = f => f, spotify = nul
<Col>
<div className='d-flex justify-content-end'>
{rateIt ?
<span><RateStars totalStars={5} onSelect={(rating) => {
updatePlaylistRating(
playlist.id,
(rating + playlist.av_rating) / (playlist.num_ratings + 1),
playlist.num_ratings + 1
).catch(error => console.error('Error:', error));
}} /></span> :
<span><RateStars
totalStars={5}
onSelect={(rating) => {
updatePlaylistRating(
playlist.id,
(rating + playlist.av_rating) / (playlist.num_ratings + 1),
playlist.num_ratings + 1
).catch(error => console.error('Error:', error));
}}
/></span> :
<span onClick={() => setRateIt(true)}>
<StarRating rating={playlist.av_rating} />
</span>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Spotify.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default class Spotify extends SpotifyWebApi {
}
await this.replaceTracksInPlaylist(
playlist.id,
track_ids.map((track_id) => `spotify:track:${track_id}`)
track_ids.map(track_id => `spotify:track:${track_id}`)
);
return playlist;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/TopPlaylists.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function TopPlaylists({ spotify }) {

useEffect(() => {
getTopPlaylists(topN)
.then((playlists) => {
.then(playlists => {
setPlaylists(playlists);
}).catch(error => console.error('Error:', error));
}, [topN]);
Expand Down

0 comments on commit 8f2e859

Please sign in to comment.