Skip to content

Share Model URL fix - #496

Closed
sayamkanwar wants to merge 4 commits into
Cloud-CV:masterfrom
sayamkanwar:share_model_fix
Closed

Share Model URL fix#496
sayamkanwar wants to merge 4 commits into
Cloud-CV:masterfrom
sayamkanwar:share_model_fix

Conversation

@sayamkanwar

Copy link
Copy Markdown

Hi,
I have fixed the bug in the share model feature which generated different URLs every time. Now it generates only one URL for a model.

Here's a demo

share_patch

Please review @Ram81 @RishabhJain2018
Thank you! :)

@Ram81

Ram81 commented Dec 10, 2018

Copy link
Copy Markdown
Member

@sayamkanwar how is this different from your work in #477 ?

@sayamkanwar

Copy link
Copy Markdown
Author

Hi @Ram81,
In #477, on clicking the share button multiple times it created a new network version in the history and it showed multiple ‘Shared Model’ entries earlier, now that has been corrected too.

@sayamkanwar

Copy link
Copy Markdown
Author

Also @Ram81, what else does the task demand? Wasn’t that the only correction in this task?

Comment thread ide/views.py
next_layer_id = request.POST.get('nextLayerId')
public_sharing = True
user = None
public_sharing = True

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this necessary?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was necessary because then the model would not be shared and hence the canvas will not render the comments and sharing stuff on the model.

Comment thread ide/views.py
except:
return JsonResponse({'result': 'error', 'error': str(sys.exc_info()[1])})

if Network.objects.filter(name=net_name).exists():

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if filter returns null

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's why there is an if statement, if this returns true then this will be executed. Else it will create a new model record.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the result is null, it will return false

Comment thread ide/views.py
user_id = int(user_id)
user = User.objects.get(id=user_id)
# load the model with the net name
model = Network.objects.get(name=net_name)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we using net_name as a unique key?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using net_name as a unique key because the only similarity between the new model and already existing model would be the model name. That's why I can't use anything else like id.

Comment thread ide/views.py
user = User.objects.get(id=user_id)
# load the model with the net name
model = Network.objects.get(name=net_name)
model_id = model.id

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there any better way to handle this for anonymous sessions?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answered above

@sayamkanwar

Copy link
Copy Markdown
Author

@Ram81, I'm sorry I had to abandon this task as I could not understand what to do in this. But I would like to work on this after the contest too.

@Ram81

Ram81 commented Dec 10, 2018

Copy link
Copy Markdown
Member

Closing this as student has abandoned the task

@Ram81 Ram81 mentioned this pull request Dec 10, 2018
@Ram81 Ram81 closed this Dec 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants