Skip to content

Commit

Permalink
Fixed minor bugs of the playlist
Browse files Browse the repository at this point in the history
  • Loading branch information
texx00 committed Jan 30, 2021
1 parent f18286b commit 12d25df
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion frontend/src/structure/TopBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TopBar extends Component{

renderBack(){
if (this.props.show_back)
return <Nav.Link key={5} className="text-bold" onClick={()=>{this.props.handleTabBack()}}><ChevronCompactLeft/>Back</Nav.Link>
return <Nav.Link key={20} className="text-bold" onClick={()=>{this.props.handleTabBack()}}><ChevronCompactLeft/>Back</Nav.Link>
else return "";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,9 @@ class BasicElement extends Component{
}

handleClick(){
console.log("prova")
if (this.props.onClick) this.props.onClick();
if (!this.props.hideOptions === "true")
if (!(this.props.hideOptions === "true"))
this.setState({...this.state, showModal: true });
if (this.props.onClick) this.props.onClick();
}

// render a trigger for a tooltip around the card content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class ControlCard extends Component{
}

createElement(type, element_factory){
// TODO check why it is taking so long to create/add an element
switch(type){
case "drawing":
this.setState({...this.state, show_modal: false, show_upload: true});
Expand Down
5 changes: 4 additions & 1 deletion server/database/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ def create_playlist(cls):
def get_playlist(cls, id):
if id is None:
raise ValueError("An id is necessary to select a playlist")
return db.session.query(Playlists).filter(Playlists.id==id).one() # todo check if there is at leas one line (if the playlist exist)
try:
return db.session.query(Playlists).filter(Playlists.id==id).one() # todo check if there is at leas one line (if the playlist exist)
except:
return Playlists.create_playlist()

@classmethod
def delete_playlist(cls, id):
Expand Down
2 changes: 1 addition & 1 deletion server/sockets_interface/socketio_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def playlist_delete(id):
@socketio.on("playlist_save")
def playlist_save(playlist):
playlist = json.loads(playlist)
pl = Playlists.create_playlist() if not "id" in playlist else Playlists.get_playlist(playlist['id'])
pl = Playlists.create_playlist() if ((not "id" in playlist) or (playlist["id"] == 0)) else Playlists.get_playlist(playlist['id'])
pl.clear_elements()
pl.name = playlist['name']
pl.add_element(playlist['elements'])
Expand Down

0 comments on commit 12d25df

Please sign in to comment.