SMILEConsortium / node-smile-server

3 stars 4 forks source link

Teacher would like to be able to upload a .csv file with question data to use in the classroom #12

Closed truedat101 closed 10 years ago

truedat101 commented 11 years ago

If we have an upload capability, teachers can load questions that are already prepared. I will post a copy of the .csv format.

truedat101 commented 11 years ago

This is high priority, and a child of: https://github.com/SMILEConsortium/smile_museum/issues/1

truedat101 commented 11 years ago

I believe the teacher app on the adhoc branch has csv export format: https://github.com/SMILEConsortium/smile_teacher_desktop/tree/adhoc

truedat101 commented 11 years ago

After doing some sleuthing through the SMILE Teacher Desktop adhoc branch, I found a snippet for the code for reading in:

        CsvReader products=new CsvReader(new InputStreamReader(new FileInputStream(target_dir + "/" + filename), "UTF-8"));
        boolean has_image_now=false;
        int row = 0;

        products.readHeaders();

        while (products.readRecord())
        {
            String num = products.get("num");
            String question = products.get("question");
            String choice1 = products.get("choice1");
            String choice2 = products.get("choice2");
            String choice3 = products.get("choice3");
            String choice4 = products.get("choice4");
            String has_image = products.get("has_image");
            String answers = products.get("answers");
            String owner_name = products.get("owner_name");
            String owner_IP = products.get("owner_IP");
truedat101 commented 11 years ago

The library that is used to load these csv files is called javacsv: http://mvnrepository.com/artifact/net.sourceforge.javacsv/javacsv

truedat101 commented 11 years ago

Here are some useful details on the csv format : http://www.csvreader.com/csv_format.php

truedat101 commented 11 years ago

Here is how they are handling image upload in the SMILE Teacher Desktop app when they upload a csv:

// perform program logic here has_image_now = has_image.equals("Y"); // has image

            index = SaveQuestion(owner_IP, owner_name, 
                       question, choice1, choice2, choice3, choice4, answers, has_image_now, true);

               if(index > -1) 
               {
                   ret = true; /// at least 1 question is added, we can proceed 

                   // copy jpg image file from target dir
                   if(has_image_now)
                      my_copy_file(target_dir+"/"+row+".jpg", curr_dir+"/"+row+".jpg");                
               }
truedat101 commented 11 years ago

I added a gist containing the sample csv format: https://gist.github.com/truedat101/5545773

truedat101 commented 11 years ago

Please start this issue before we get to the other issues.

pinazo commented 11 years ago

The PUT/POST must be done with "text/csv" mime-type to work properly. The functional test is in tests/functional/csv.test.js.

truedat101 commented 11 years ago

Juan, how do we handle image upload? We will need to support that.

pinazo commented 11 years ago

Until now we handle it as base64 in a JSON. I didn't check yet how the student app sends the image to the server, I assumed it would be implemented within issue #14.


Juan Pinazo

On Mon, May 13, 2013 at 12:24 AM, truedat101 notifications@github.comwrote:

Juan, how do we handle image upload? We will need to support that.

— Reply to this email directly or view it on GitHubhttps://github.com/SMILEConsortium/node-smile-server/issues/12#issuecomment-17791401 .

truedat101 commented 11 years ago

Please validate that the new push of the sample .csv format is functional: b2f53ae . We had some incorrect or incomplete version checked in.

pinazo commented 10 years ago

Jobandtalent mail /* Reset */

outlook a {padding:0;}

  body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;}
  .ExternalClass {width:100%;background:#E7E6E5;}
  .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;}
  #backgroundTable {margin:0; padding:0; width:100% !important; line-height: 100% !important;}
  /* Some sensible defaults for images */
  img {outline:none; text-decoration:none; -ms-interpolation-mode: bicubic;}
  a img {border:none;}
  .image_fix {display:block;}

  /* Yahoo paragraph fix */
  p {margin:0;}

  /* Outlook 07, 10 Padding issue */
  table td {border-collapse: collapse;}

  /* Remove spacing around Outlook 07, 10 tables */
  table { border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; }

  @media only screen and (max-width: 500px) {
    .content, .radius_wrapper, .copy-table #copy {
      width:auto!important;
    }

  }

  /***************************************************
  MOBILE TARGETING
  ***************************************************/

  @media screen and (max-device-width: 480px) {

    #header {
      padding:40px 10px 20px!important;
    }

  }

  .copy-table + p {
    color:#869299;
    text-align:center;
    font-size:12px;
  }

                Sign up

Juan Pinazo
has sent you an invitation to 

  join jobandtalent

Receive personalized job suggestions tailored to your professional interests and search over 200,000 jobs across all industries. With jobandtalent you'll never miss another job opportunity

Accept the invitation

If the link doesn’t work, copy and paste this url on your browser:

 Companies hiring right now

          You are receiving this email because one of your friends is inviting you to register at jobandtalent.com  (3rd floor, 36-37 Featherstone Street London EC1Y 8QZ)
truedat101 commented 10 years ago

This is all working in #26. Closing.