emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Matt Price <moptop99@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: Showing Property in headline; generating table from properties; exporting table to CSV
Date: Thu, 06 Aug 2015 09:52:29 -0400	[thread overview]
Message-ID: <m2mvy4h6ci.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <CAN_Dec-BzSZQMXSt=m9ahwVEGTjdTx7_xZ6iH6krMBR=ZoyQOQ@mail.gmail.com>

This gets you pretty close to what you want. I changed some grades to
make it easier to see it is doing the right thing.

#+BEGIN_SRC emacs-lisp
(setq assignments '())
(setq students '())

;; get assignments
(org-map-entries
 (lambda ()
   (when (= 1 (nth 0 (org-heading-components)))
     (add-to-list 'assignments (nth 4 (org-heading-components)) t))))

;; get student names as list of cons cells
(org-map-entries
 (lambda ()
   (when (= 2 (nth 0 (org-heading-components)))
     (add-to-list 'students (cons  (nth 4 (org-heading-components)) '()) t))))


;;loop over entries
(dolist (assignment assignments)
  (save-excursion
    ;; jump to assignment
    (org-open-link-from-string (format "[[*%s]]" assignment))
    ;; map over entries
    (org-map-entries
     (lambda ()
       (let* ((student (car (assoc (nth 4 (org-heading-components)) students))))
         (when student
           (setf (cdr (assoc student students))
                 (append (cdr (assoc student students))
                         (list (org-entry-get (point) "GRADE")))))))
     nil 'tree)))

(setq gradebook
      (append (list  (append '("Student") assignments)
                     'hline)
              students))

(orgtbl-to-csv gradebook nil)
#+END_SRC

#+RESULTS:
: Student,Definition,Darwin
: Student One,10,40
: Student Two,20,50
: Student Three,30,60



Matt Price writes:

> Hello eveyrone!
>
> I know the big guns are all working on last-minute 8.3 bugs (thank you!).
>
> I am hoping to get some guidance before heading off on vacation.  I have
> switched over to doing all grading for my courses in org.  My workflow:
>
> - export a csv file containing student names.
> - generate grading templates for each student, for each assignment
> - email comments back to students
> - enter marks in an official spreadsheet which can be used for final grade
> submission
>
> A sample  "Comments.org" is at the bottom of this email (it was a little
> long).
>
> So, here are my questions:
>
> - I currently store my grades as properties of level-2 headlines. However,
> I would really like to be able to see the grades when the headline is
> folded, so I can have a quick visual sense of how many papers I've marked,
> how well the students are doing, and so forth.  THe best would be to be
> able to see the actual marks in the headlines; but if I could, say, adjust
> the color of the healdine based on the property value, that would be cool
> too.
>
> - It seems silly to record the grades once in org, and then again in a
> libreoffice spreadsheet.  Better would be to generate a table and/or csv
> spreadsheet directly from the headlines and property values.  So, the
> example below would give the table:
> | Student       | Definition | Darwin |
> | Student One   |          0 |      0 |
> | Student Two   |          0 |      0 |
> | Student Three |          0 | 0      |
>
> and from there I guess I could generate a CSV just with org-table-export.
>
> Had anyone done either of these tasks before? Any guidance on how to do
> it?
>
> Thanks as always,
> Matt
>
> ------------------------------------------
> * Definition
> ** TODO Student One
> :PROPERTIES:
> :GRADE:    0
> :MAIL_TO:  student.one@utoronto.edu
> :MAIL_CC:  matt.price@utoronto.ca
> :MAIL_REPLY: matt.price@utoronto.ca
> :MAIL_SUBJECT: Comments on Definition Assignment (Student One)
> :END:
> - Organization ::
> - Clarity of Thesis ::
> - Presentation of Evidence ::
> - Grammar and Spelling ::
> - Style ::
> - Citations ::
> - Further Comments ::
> - Grade ::
> ** TODO Student Two
> :PROPERTIES:
> :GRADE:    0
> :MAIL_TO:  student.two@utoronto.edu
> :MAIL_CC:  matt.price@utoronto.ca
> :MAIL_REPLY: matt.price@utoronto.ca
> :MAIL_SUBJECT: Comments on Definition Assignment (Student Two)
> :END:
> - Organization ::
> - Clarity of Thesis ::
> - Presentation of Evidence ::
> - Grammar and Spelling ::
> - Style ::
> - Citations ::
> - Further Comments ::
> - Grade ::
> ** TODO Student Three
> :PROPERTIES:
> :GRADE:    0
> :MAIL_TO:  student.three@utoronto.edu
> :MAIL_CC:  matt.price@utoronto.ca
> :MAIL_REPLY: matt.price@utoronto.ca
> :MAIL_SUBJECT: Comments on Definition Assignment (Student Three)
> :END:
> - Organization ::
> - Clarity of Thesis ::
> - Presentation of Evidence ::
> - Grammar and Spelling ::
> - Style ::
> - Citations ::
> - Further Comments ::
> - Grade ::
>
>
> * Darwin
> ** TODO Student One
> :PROPERTIES:
> :GRADE:    0
> :MAIL_TO:  student.one@utoronto.edu
> :MAIL_CC:  matt.price@utoronto.ca
> :MAIL_REPLY: matt.price@utoronto.ca
> :MAIL_SUBJECT: Comments on Darwin Assignment (Student One)
> :END:
> - Organization ::
> - Clarity of Thesis ::
> - Presentation of Evidence ::
> - Grammar and Spelling ::
> - Style ::
> - Citations ::
> - Further Comments ::
> - Grade ::
> ** TODO Student Two
> :PROPERTIES:
> :GRADE:    0
> :MAIL_TO:  student.two@utoronto.edu
> :MAIL_CC:  matt.price@utoronto.ca
> :MAIL_REPLY: matt.price@utoronto.ca
> :MAIL_SUBJECT: Comments on Darwin Assignment (Student Two)
> :END:
> - Organization ::
> - Clarity of Thesis ::
> - Presentation of Evidence ::
> - Grammar and Spelling ::
> - Style ::
> - Citations ::
> - Further Comments ::
> - Grade ::
> ** TODO Student Three
> :PROPERTIES:
> :GRADE:    0
> :MAIL_TO:  student.three@utoronto.edu
> :MAIL_CC:  matt.price@utoronto.ca
> :MAIL_REPLY: matt.price@utoronto.ca
> :MAIL_SUBJECT: Comments on Darwin Assignment (Student Three)
> :END:
> - Organization ::
> - Clarity of Thesis ::
> - Presentation of Evidence ::
> - Grammar and Spelling ::
> - Style ::
> - Citations ::
> - Further Comments ::
> - Grade ::
> ---------------------------------------------
>
> I have three remaining issues

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

  parent reply	other threads:[~2015-08-06 13:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-06 11:24 Showing Property in headline; generating table from properties; exporting table to CSV Matt Price
2015-08-06 11:28 ` Eric S Fraga
2015-08-06 11:34   ` Nicolas Goaziou
2015-08-06 12:17     ` Eric S Fraga
2015-08-06 12:24     ` Matt Price
2015-08-06 13:44       ` Nicolas Goaziou
2015-08-06 13:13   ` John Kitchin
2015-08-06 13:29     ` Matt Price
2015-08-06 14:19       ` John Kitchin
2015-08-06 16:39         ` Matt Price
2015-08-06 16:47           ` John Kitchin
2015-08-07 16:41         ` Pip Cet
2015-08-10 14:41           ` Eric S Fraga
2015-08-07  1:43       ` Richard Lawrence
2015-08-06 14:06   ` John Kitchin
2015-08-06 16:26     ` Matt Price
2015-08-06 13:52 ` John Kitchin [this message]
2015-08-06 17:27   ` Matt Price
2015-08-06 18:14     ` John Kitchin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2mvy4h6ci.fsf@andrew.cmu.edu \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=moptop99@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).