Giter VIP home page Giter VIP logo

diderot-cli's People

Contributors

acarumut avatar arturts avatar bojanbg avatar godmode-on avatar mooey5775 avatar moridyn avatar rohany avatar umutacar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

diderot-cli's Issues

set current course

it would be nice if diderot could be run like this:

(invoke diderot with my course)
$ diderot 15210    
this asks me to log in and sets my course by default this would be current semester
$ diderot Fall18 15210 
would do the same as above but would find the Fall18 edition
after the user logs on like this, they would not have to provide course label to the queries, which is a bit cumbersome. 

Diderot website should have an empty public repo to collect issues.

I have some issues/improvements I want to report, including:

  • Center-clicking on notes in the notifications should open the particular notification in a new tab; it just takes you to the post office.
  • Ctrl+enter should post-and-close open responses. (Perhaps Ctrl+shift+enter can post-and-open responses?)
  • When posting an annoucement, I get an email even if I uncheck the "send an email" option.

Should this be a embedded console?

Discussion with iliano has brought up a good question -- should this actually be an embedded console? If it is more useful to just run individual commands, then perhaps we should just have a true CLI instead.

I believe we should collect some feedback from both students and administrators before making a full decision.

no parts for booklets

Diderot distinguishes between two kinds of books, those with & without parts. The latter are called booklets. Most people will use these. The create chapter currently seems to require a part even if the book is a booklet. See below

create_chapter --number 15 --title 'Chapter from CLI' BAL
create_chapter --number 15 --title 'Chapter from CLI' BAL
usage: create_chapter [-h] --part PART --number NUMBER [--title TITLE]
                      [--label LABEL]
                      book
create_chapter: error: the following arguments are required: --part

some bugs

can't seem to find course and list courses
bash-3.2$ ./diderot
Username: diderot
Password:
Successfully logged in to Diderot.
DiderotCLI >> list_assignments 15210:S19
list_assignments 15210:S19
Invalid input course label.
Error retrieving all assignments.
DiderotCLI >> list_assignments 15210:S19
list_assignments 15210:S19
Invalid input course label.
Error retrieving all assignments.
DiderotCLI >> list_courses
list_courses
Unable to make a request to Diderot.
Error retrieving all courses.

large code refactors

the cli is literally drowning in technical debt -- new changes are quite difficult to make...

Setting "use_parent_dost_assignment_rules" field

The chapter and book models have some new fields, so we want to make sure they are initialized properly. In particular, the use_parent_dost_assignment_rules field is important. It looks like when a new chapter is created, this field is set to False (though the default value is True so not sure why this is the case). I assume the same thing is true for book creation.

upload_book: publish/release data etc

allow setting various parameters

  • publish/release data
  • is_submittable (done automatically, skip)
  • solutions_released (let's not do this because this keeps changing)
    etc

Dates

Instead of actual dates, it could be better to use
week#/day/time notation
THis would make json's reusable between different esemesters.

For example 11/2/23:05 means 11th week 2 day of the week 11:05pm.

Note first day of the week is determined by the start day of the course, typically Sunday or Monday.
Note also there is a timezone issue, maybe we can use the course time zone to do this

Perhaps allow both:

  • "publish_on_date": "2/5/2021, 13:30" --- this means publish on the date, what is the timezone?
  • "publish_on_week": "5/4, 14:30" --- week 5, day 4 (of the week), this is course relative. first day of the week = saturday/sunday/monday,..."

focus for book uploads

once a book json spec is written it has all the information needed to upload a chapter (e.g., name of pdf/xml files, attachments, etc) so we can use it to upload single chapters and parts. For example, like this

diderot_admin upload-book --only-chapter < chapter number >
diderot_admin upload-book --only-part < part number >

book and booklet uploads

allow booklet and book to be specified as a json file and be created and uploaded wholesale

{book: exam/,
 title: Exam 1,
 label: EXAM1,
    chapter : {
      xml: truefalse/truefalse.xml, 
      pdf: truefalse/truefalse.pdf
     }
    chapter: {
      xml: shortanswers/shortanswers.xml, 
      attachments: shortanswers/media,
     pdf: hortanswers/shortanswers.pdf
     },
    chapter {
       xml: dfs/dfs.xml, 
      attachemnts: dfs/media, 
      pdf: dfs/dfs.pdf
    }
}
{book: exam/,
 title: Exam 1,
 label: EXAM1
 part 1: { 
    label: part:truefalse,    
    title:  True-False Problems,
    chapter : {
      xml: truefalse/truefalse_version1.xml, 
      pdf: truefalse/truefalse_version1.pdf
     }
    chapter : {
      xml: truefalse/truefalse_version2.xml, 
      pdf: truefalse/truefalse_version2.pdf
     }
  },
  part 2: {
    label: part:shortanswers,
    title: Short Answers,
    chapter: {
      xml: shortanswers/shortanswers_version1.xml, 
      attachments: shortanswers/media_version1,
     pdf: hortanswers/shortanswers_version1.pdf
     },
    chapter: {
      xml: shortanswers/shortanswers_version2.xml, 
      attachments: shortanswers/media_version2,
     pdf: hortanswers/shortanswers_version2.pdf
     }
  } 
  part 3: {
    label: part:dfs,
    title: Depth First Search
    chapter {
       xml: dfs/dfs.xml, 
      attachemnts: dfs/media, 
      pdf: dfs/dfs.pdf
    }
  }
}

Automated testing suite for the CLI

Can spin up a simple testing server and connect to that, and have sample data given back at each api call. This can test a variety of things and help further development.

Add due and release date control

Set due/release date
Clear due/release date

Use week#/day/time notation rather than exact date so that it is reusable across semesters
For example 11/2/23:05 means 11th week 2 day of the week 11:05pm.

Note first day of the week is determined by the start day of the course, typically Sunday or Monday.

Course selection upgrades

Courses on Diderot have both a number (not necessarily unique), and a label (which is unique). Right now, all interfacing with courses is through the label, which is not intuitive. To make this better, it would be nice to just support inputting both labels and numbers, and fall back to a label if there are multiple courses with the same number.

Support different filetypes for handin

Diderot accepts single file handins, as well as tar files. However, diderot needs to be told which type of file is being sent so that it handles it correctly. Doing this would involve checking what type of file is being uploaded, and populating the request headers with the correct keys using that information.

Logged in vs Logged out

The api_calls.py right now is littered with logic that checks if a user is logged in or not. This doesn't seem important right now, so we should remove it.

label

our new course labels include spaces commas etc. this leads to an error

make list_chapters
/Users/umut/diderot/diderot-cli/diderot_admin list_chapters "CMU:Pittsburgh, PA:15210:Spring:2019-20" "TB"
Invalid input course label.
Error listing chapters.
make: *** [list_chapters] Error 1
bash-3.2$ 

CLI guide

A very basic guide to CLI would be helpful. Add this as a separate chapter in the repo guide

As a stub, I created cli/cli.tex, and put in an outline.

Makefile should work.

diderot-admin

I got stuck when trying to update a chapter. I used the command incorrectly but there was no "help".

bash-3.2$ admin/diderot_admin 
admin/diderot_admin 
Username: ..
Password: ..
Successfully logged in to Diderot.
DiderotCLI >> help
help

Documented commands (type help <topic>):
========================================
EOF                  help              list_courses       update_assignment
download_assignment  list_assignments  quit               update_book      
exit                 list_books        submit_assignment

DiderotCLI >> update_book guide mtl --xml ~/diderot/guide/mtl/mtl.xml 
update_book guide mtl --xml ~/diderot/guide/mtl/mtl.xml 
Failure uploading book.
DiderotCLI >> help update_book
help update_book

create part

would be nice to be able to create a part from the CLI.

Update error handling

Right now, all the functions in api_calls.py return None or some arbitrary value when something fails. It would be better to have more descriptive error messages / handling when something goes wrong, so that users can be notified of what to do.

create chapter title

Should the title be a string? I wasn't able to create a chapter with a title like this "Chapter from CLI"
For this command, displaying an example would help.

Add some nice aliases.

Umut suggested a few aliases, such as cc -> set_course, mc -> make chapter etc. Set up a framework for easily handling aliases.

set course and list books

the list_books command doesn't seem to take current course into account and seem to list all courses

...
Successfully logged in to superuser.
DiderotCLI >> list_books
list_books
book:problem-sets	book:textbook	book:lecture-notes	notes	slides	TB	course-notes	book:slides	Miscellaneous	book:homeworks	homeworks	slides	guide	book:recitations	Notes	books:solns	hw	book:recitations	textbook	Slides	LIBDOC	REC	book:slides	book:lecture-notes	slides	mics	book:homework	book:miscellaneous	labs	textbook	book:recitations	book:writtens	prog	book:textbook	book:lecture-notes	book:lecture-slides	BAL
DiderotCLI >> list_courses
list_courses
15122-N19	15281-N19	15780:S19	15251:s19	15122-DEVELOPMENT	15359-fall09	15388:DEV	15388:f19	15210:S19	cs109-dev	15000:diderotguide:f19	utah-3100:modelsofcom	15819:quantpa:f19	15251:f19	15455:f19	15210:F19	15122:f19
DiderotCLI >> set_course 15210:S19
set_course 15210:S19
Course set successfully.
DiderotCLI/15210:S19 >> list_books
list_books
book:problem-sets	book:textbook	book:lecture-notes	notes	slides	TB	course-notes	book:slides	Miscellaneous	book:homeworks	homeworks	slides	guide	book:recitations	Notes	books:solns	hw	book:recitations	textbook	Slides	LIBDOC	REC	book:slides	book:lecture-notes	slides	mics	book:homework	book:miscellaneous	labs	textbook	book:recitations	book:writtens	prog	book:textbook	book:lecture-notes	book:lecture-slides	BAL

chapter uploads

I recall that we talked about this but I am not sure if it has been implemented. It would be nice to allow instructors and TA's to upload chapters like this

$ did upload -book <book label> -chapter <chapter number> -attach path/to/attachments path/to/chapter/main.[xml | pdf]

Once invoked, this command could terminate immediately, but it would be better if it "spun" its wheels, e.g., by printing a "." every 1 seconds or so and then take the return value from the chapter upload and print it.

This requires some coordination between the book uploads API. Perhaps the trickiest part is that it would have to construct a request object with file attachments (e.g., typically some image files).

How much work would this require?

Better solution than always looking in the same place for credentials

Umut brought up a good point, that if we always look ~/.diderot/credentials, then that will encourage students to store their passwords in that location. However, that location by default is not private on AFS, and it could lead to students seeing other student's passwords. We need a way to work around this.

chapter uploads

@rohany

This (PR #8) is great!!
I have a few suggestions for the command arguments.
Recall the command is

update_book <book label> <chapter label> [--pdf  [--video_url] | --slides  [--video_url] | --xml [--images] [--xml_pdf] ]
  • book label isn't unique across courses. so this CLI would not know which course to update. perhaps change this so that it logs you onto a course, as I suggested in #10.
  • chapter label is not user friendly here because it will likely be a mambo jambo string maybe just include the number?

update_book command

  • change the name to `upload_chapter'

  • Change images --> attach
    We migth want to attach anything. I don't recall how this works, but it would be best if it took a directory and took everything within that directory (also recursively) and uploaded onto diderot (as a list of files), e.g.,
    dirA/fileA.png
    dirA/dirAA/fileAA.jpg

would upload both files fileA.png and fileAA.png.

  • There seems to be something wrong with image uploads see below. If I don't supply the --images directory than it works.
DiderotCLI/15210:S19 >> update_book --xml ~/diderot/15897/lambda/lambda.xml --images ~/diderot/15897/lambda
update_book --xml ~/diderot/15897/lambda/lambda.xml --images ~/diderot/15897/lambda
usage: update_book [-h] [--pdf PDF] [--slides SLIDES] [--video_url VIDEO_URL]
                   [--xml XML] [--images IMAGES [IMAGES ...]]
                   [--xml_pdf XML_PDF]
                   book chapter
update_book: error: the following arguments are required: book, chapter
DiderotCLI/15210:S19 >> update_book --xml ~/diderot/15897/lambda/lambda.xml --images ~/diderot/15897/lambda TB 61
update_book --xml ~/diderot/15897/lambda/lambda.xml --images ~/diderot/15897/lambda TB 61
usage: update_book [-h] [--pdf PDF] [--slides SLIDES] [--video_url VIDEO_URL]
                   [--xml XML] [--images IMAGES [IMAGES ...]]
                   [--xml_pdf XML_PDF]
                   book chapter
update_book: error: the following arguments are required: book, chapter
DiderotCLI/15210:S19 >> update_book --xml ~/diderot/15897/lambda/lambda.xml TB 61
update_book --xml ~/diderot/15897/lambda/lambda.xml TB 61
Begin upload to Course: 15210:S19, Book: TB, Chapter Number: 61, Chapter Title: CLI-CHAPTER? Enter yes to proceed. Any other input will cancel the upload.
yes
yes
Waiting for book upload to complete...

makefiles for stuff

would be nice to have a single makefile that could

  • run tests
  • create a release zip/tar
  • other fun stuff!

Navigating chapters

Maybe add in some information about navigating chapters -- see chapters, provide links to new chapters / sections? Might be useful.

cli part creation

CLI seems to "allow" a student to create a part. it says that it created the part even though it didn't.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.