Skip to content

Commit

Permalink
Fix for GetAssignments()
Browse files Browse the repository at this point in the history
Fix for "Error in as.POSIXlt.character(x, tz, ...) : character string is not in a standard unambiguous format" when running GetAssignments().
  • Loading branch information
tylerburleigh committed Oct 5, 2019
1 parent 6ce7c6c commit 33740a1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## [1.14] - 2019-10-04
Fix for "Error in as.POSIXlt.character(x, tz, ...) : character string is not in a standard unambiguous format" when running GetAssignments().

## [1.13] - 2019-10-02
Added an error handler when hit.type and qual.req are both used in call to CreateHIT(). Both cannot be used at the same time. (thanks to Jeremy for identifying this problem!)

Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: pyMTurkR
Type: Package
Title: A Client for the 'MTurk' Requester API
Version: 1.13
Version: 1.14
Authors@R: c(person("Tyler", "Burleigh",
role = c("aut", "cre"),
email = "[email protected]",
Expand Down
12 changes: 12 additions & 0 deletions R/ToDataFrame.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,19 +148,31 @@ ToDataFrameAssignment <- function(assignment) {
Assignment[3] <- assignment$HITId
Assignment[4] <- assignment$AssignmentStatus
Assignment[5] <- reticulate::py_to_r(assignment$AutoApprovalTime)

if (!is.null(assignment$AcceptTime)) {
Assignment[6] <- reticulate::py_to_r(assignment$AcceptTime)
} else {
Assignment[6] <- as.POSIXct(NA, origin = '1970-01-01')
}

Assignment[7] <- reticulate::py_to_r(assignment$SubmitTime)

if (!is.null(assignment$ApprovalTime)) {
Assignment[8] <- reticulate::py_to_r(assignment$ApprovalTime)
} else {
Assignment[8] <- as.POSIXct(NA, origin = '1970-01-01')
}

if (!is.null(assignment$RejectionTime)) {
Assignment[9] <- reticulate::py_to_r(assignment$RejectionTime)
} else {
Assignment[9] <- as.POSIXct(NA, origin = '1970-01-01')
}

if (!is.null(assignment$RequesterFeedback)) {
Assignment[10] <- assignment$RequesterFeedback
}

if (!is.null(assignment$Answer)) {
answers <- ToDataFrameQuestionFormAnswers(Assignment, assignment$Answer)
return.answers <- rbind(return.answers, answers)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![travis-ci](https://travis-ci.org/cloudyr/pyMTurkR.svg?branch=master)](https://travis-ci.org/cloudyr/pyMTurkR?branch=master)
[![codecov test coverage](https://codecov.io/gh/cloudyr/pyMTurkR/branch/master/graph/badge.svg)](https://codecov.io/gh/cloudyr/pyMTurkR?branch=master)
[![CRAN version](https://img.shields.io/cran/v/pyMTurkR)](https://cran.r-project.org/package=pyMTurkR)
![dev version](https://img.shields.io/badge/dev-1.13-blue)
![dev version](https://img.shields.io/badge/dev-1.14-blue)
[![lifecycle](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://www.tidyverse.org/lifecycle)
![CRAN downloads](https://cranlogs.r-pkg.org/badges/grand-total/pyMTurkR)
<!-- badges: end -->
Expand Down

0 comments on commit 33740a1

Please sign in to comment.