Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def main():

print "Successfully connected to TSheets. Grabbed the current user's id: {}".format(user_id)

# Make sure we can pull last-modified, non-paginated
last_modified = api.last_modified_timestamps.where(endpoints='timesheets')
print "Found timestamp for timesheets: {}".format(last_modified.first().timesheets)

# get a list of job codes
my_jobcode = None
jobcodes = api.jobcodes.where(type = 'regular', active = True)
Expand Down
1 change: 1 addition & 0 deletions tsheets/models/custom_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class CustomField(Model):


CustomField.add_field("id", int)
CustomField.add_field("active", bool)
CustomField.add_field("name", str)
CustomField.add_field("short_code", str)
CustomField.add_field("required", bool)
Expand Down
1 change: 1 addition & 0 deletions tsheets/repos/custom_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class CustomFields(Repository):
CustomFields.add_model(models.CustomField)
CustomFields.add_actions([u'list'])
CustomFields.filter("ids", [int])
CustomFields.filter("active", bool)
CustomFields.filter("applies_to", str)
CustomFields.filter("value_type", str)
CustomFields.filter("modified_before", str)
Expand Down
1 change: 1 addition & 0 deletions tsheets/repos/last_modified_timestamps.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ class LastModifiedTimestamps(Repository):
LastModifiedTimestamps.add_url("/last_modified_timestamps")
LastModifiedTimestamps.add_model(models.LastModifiedTimestamps, singleton=True)
LastModifiedTimestamps.add_actions([u'list'])
LastModifiedTimestamps.filter("endpoints", str)
8 changes: 6 additions & 2 deletions tsheets/results.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from helpers import class_to_endpoint
import repos


class Results(object):
Expand Down Expand Up @@ -34,8 +35,11 @@ def all(self):
return list(self)

def _load_next_batch(self):
if self.repo.filters.get('page', False):
self.options.update({'page': self.page})
# Because LastModifiedTimestamps can't deal with pagination, we have
# to exclude it here.
if not isinstance(self.repo, repos.LastModifiedTimestamps):
if self.repo.filters.get('page', False):
self.options.update({'page': self.page})
response = self.bridge.next_batch(self.url, self.name, self.options, self.is_singleton, self.mode)

batch = response['items']
Expand Down