Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Share] Added possibility to share projects to S3 #77

Open
wants to merge 2,327 commits into
base: master
Choose a base branch
from

Conversation

NicolasWent
Copy link
Collaborator

This pull request's aim is to be able to click on a share button in order to share your project to S3, then we get an url and we can post this URL anywhere we want.

How to use?

You need to download the node server at Task Store

Once you have it, download requirements, you need to specify the S3 identifiers in .aws/credentials then run:
node app.js

Once you have done it, you need to find two folders from the SVN:
v01/QuickPi/nicolas/testbed_share for share the exercise
v01/QuickPi/nicolas/testbed_load for load the exercise

Once you found these files, you need to open the index.html from testbed_load. Copy the url of the file and paste it in the file
interface-mobileFirst (around lign 373), to change the url.

Once you have finish setting up everything, run the index.html of testbed_share, and in the menu you can click on the share button, it will give you the share url that you can copy in order to open your exercise but from S3.

In production:

Once in production, there are some things that we must setup:

  1. In interface-mobileFirst.js change the url at lign 376 to the real url (from quickpi)
  2. You also need to change the server in $.post and put there the real url of the node server.
  3. In testbed_load, you need to change the url (instead of localhost put the url you put in 2)

mblockelet and others added 30 commits October 10, 2020 15:30
…registered the onlick only when not in fullscreen
Copy link
Contributor

@mblockelet mblockelet left a comment

Choose a reason for hiding this comment

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

A few comments already ; I haven't tested the full process yet so there will probably be other comments to come.

pemFioi/quickAlgo/interface-mobileFirst.js Outdated Show resolved Hide resolved
pemFioi/quickAlgo/interface-mobileFirst.js Show resolved Hide resolved
var answerType = that.blocklyHelper.isBlockly ? "blockly" : "python";

// TODO: change with "prod" url
var url = "file:///home/nicolas/stage/test/v01/QuickPi/dynamicTestbed/testbed/index.html";
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not very generic to have an URL, specific to quick-pi, in interface-mobileFirst. As this system could be used with multiple tasks, there should be a mechanism for the task to give the URL for sharing.


// We retrieve the saved answer of the user.
// with this method, we can get the updated answer (after save) for all the levels.
answer: that.subtask.getAnswerObject()
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're going to share the answer, the user should be asked whether they want to share their answer or not. If I create my own task for others to try solving it, I don't want them to get my answer as well, or it would miss the point. On the other side, indeed, there are cases in which we'd want to share the program as well. Hence it's better to ask the user about their intent.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For now on, it is just sharing of testbed subjects to S3.

Later on, this feature will evolve in something that can share exercise. But in case of a project, the code should allways be shared.

mainTask.loadLevel(state.level, null, views);
if(levels) {
displayHelper.setupLevels(defaultLevel, reloadWithCallbacks, levels);
}
if (answer) {
mainTask.reloadAnswerObject(answer)
Copy link
Contributor

Choose a reason for hiding this comment

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

These modifications don't have anything to do in a common file used by lots of tasks, many which aren't using quickAlgo. It's really best to avoid modifying files which are outside the scope of your project, when you don't know whether it could break completely unrelated tasks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unfortunately, I didn't found any better place to do this, maybe you know where it could be put? And normally nothing should happens if answer is null which is the case in 99% of cases.

The only case it could break is if mainTask is null I don't know if it happens in a weird subject.

Copy link
Contributor

Choose a reason for hiding this comment

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

It should be put after loading the data from the remote task. Where are you setting mainTask.answer ? You should reload the answer from there instead.

nothing should happens if answer is null which is the case in 99% of cases

Are you sure of that? I'm pretty sure you haven't checked all the Bebras tasks :)

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.

8 participants