Example #1
0
def delete_unused_accounts(account):
  """Delete accounts for uses that don't participate in any reviews."""
  email = account.user.email()
  if Issue.all().filter('owner_email =', email).get():
    return
  if Issue.all().filter('cc =', email).get():
    return
  if Issue.all().filter('reviewers =', email).get():
    return
  logging.warn('Deleting %s' % email)
  yield op.db.Delete(account)
Example #2
0
def delete_unused_accounts(account):
  """Delete accounts for uses that don't participate in any reviews."""
  email = account.user.email()
  if Issue.query(Issue.owner_email == email).get():
    return
  if Issue.query(Issue.cc == email).get():
    return
  if Issue.query(Issue.reviewers == email).get():
    return
  logging.warn('Deleting {0!s}'.format(email))
  yield op.db.Delete(account)
def main():
    sem = Semester.all().get()

    readers = Account.all().ancestor(sem).filter('role =', 1).run()

    grade_mapping = {}      # mapping of reader email to average grade
    reader_mapping = {}     # mapping of student login to reader login
    login_to_email = {}

    with open('data') as data_f:
        for line in data_f:
            login, email = [x.strip() for x in line.split(',')]
            login_to_email[login] = email

    for reader in readers:
        print reader.email
        stus = list(Account.all().ancestor(sem).filter('reader = ', reader).run())
        issues = []
        for stu in stus:
            reader_mapping[stu.email] = reader.email
            issues.extend(list(Issue.all().filter("semester =", sem.name).filter('subject =', 'proj1').filter('owners =', stu.email).run()))

        grade_mapping[reader.email] = float(sum(iss.comp_score for iss in issues if iss.comp_score > -1)) / len(issues)

    print grade_mapping
    print reader_mapping
    print login_to_email
Example #4
0
 def test_not_an_email_address(self):
   descriptions = [
       'Howdie!\n\nCOLLABORATOR=joi\nBUG=12345',
       'Howdie!\n\nCOLLABORATOR=joi@google\nBUG=12345',
   ]
   for description in descriptions:
     self.assertEqual(
       [], Issue._collaborator_emails_from_description(description))
Example #5
0
 def test_not_an_email_address(self):
   descriptions = [
       'Howdie!\n\nCOLLABORATOR=joi\nBUG=12345',
       'Howdie!\n\nCOLLABORATOR=joi@google\nBUG=12345',
   ]
   for description in descriptions:
     self.assertEqual(
       [], Issue._collaborator_emails_from_description(description))
Example #6
0
 def test_one_valid_collaborator(self):
   descriptions = [
       'Howdie!\n\[email protected]\nBUG=12345',
       'Howdie!\n\[email protected] \nBUG=12345',
       'Howdie!\n\n COLLABORATOR =\[email protected] \nBUG=12345',
       'Howdie!\nCOLLABORATOR = [email protected] \nCOLLABORATOR=smurf',
   ]
   for description in descriptions:
     self.assertEqual(
         ['*****@*****.**'],
         Issue._collaborator_emails_from_description(description))
Example #7
0
 def test_one_valid_collaborator(self):
   descriptions = [
       'Howdie!\n\[email protected]\nBUG=12345',
       'Howdie!\n\[email protected] \nBUG=12345',
       'Howdie!\n\n COLLABORATOR =\[email protected] \nBUG=12345',
       'Howdie!\nCOLLABORATOR = [email protected] \nCOLLABORATOR=smurf',
   ]
   for description in descriptions:
     self.assertEqual(
         ['*****@*****.**'],
         Issue._collaborator_emails_from_description(description))
def main():
    good = seen = 0
    for issue in Issue.all().filter('subject =', args.assignment).filter('semester =', args.semester):
        seen += 1
        if issue.comp_score > -1:
            for stu in issue.owners:
                good += 1
                grades[stu] = issue.comp_score
        if seen % 50 == 0 or good % 50 == 0:
            print "good {} seen {}".format(good, seen)
    for k in grades:
        print "{} : {}".format(k, grades[k])
    if args.file:
        with open(args.file, 'w') as f:
            for k in grades:
                f.write("{} : {}\n".format(k, grades[k]))
def find_all(assign):
    with open('out', 'w') as f:
        issues = Issue.all().filter(u'subject =', assign).fetch(100)
        for iss in issues:
            #print iss.reviewers
            acc = [Account.get_account_for_email(stu) for stu in iss.reviewers]
            #print accs
            acc = [a for a in acc if len(str(a)) > 4]
            #print [a.email for a in acc]
            sections = [a.sections for a in acc]
            if sections:
                all_sections = set(reduce(lambda a, b: a + b, sections))
                #print all_sections
                if len(set(all_sections)) > 1:
                    val = iss.key().id()
                    print val, iss.sections
                    f.write("{} {}\n".format(val, iss.sections))
            else:
                print 'uhoh'
                print iss.sections
Example #10
0
 def test_multiple_collaborators(self):
   collaborators = Issue._collaborator_emails_from_description(
       'Hello world!\[email protected]\[email protected]')
   self.assertEqual(['*****@*****.**', '*****@*****.**'], collaborators)
Example #11
0
 def test_no_collaborator(self):
   description = 'Hello!\n\nBUG=12345'
   self.assertEqual(
       [], Issue._collaborator_emails_from_description(description))
Example #12
0
 def test_multiple_collaborators(self):
   collaborators = Issue._collaborator_emails_from_description(
       'Hello world!\[email protected]\[email protected]')
   self.assertEqual(['*****@*****.**', '*****@*****.**'], collaborators)
Example #13
0
 def test_no_collaborator(self):
   description = 'Hello!\n\nBUG=12345'
   self.assertEqual(
       [], Issue._collaborator_emails_from_description(description))