{"id":15288801,"url":"https://github.com/sztheory/streakable","last_synced_at":"2025-07-12T05:02:30.868Z","repository":{"id":59156572,"uuid":"154542613","full_name":"szTheory/streakable","owner":"szTheory","description":"Track consecutive day streaks in your ActiveRecord models","archived":false,"fork":false,"pushed_at":"2019-10-01T18:19:51.000Z","size":69,"stargazers_count":16,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-12T05:02:07.705Z","etag":null,"topics":["calendar","mit-license","ruby","ruby-gem","ruby-on-rails","streak","streaks"],"latest_commit_sha":null,"homepage":"https://sztheory.github.io/streakable/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/szTheory.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-24T17:38:46.000Z","updated_at":"2023-07-31T06:39:25.000Z","dependencies_parsed_at":"2022-09-13T17:50:54.715Z","dependency_job_id":null,"html_url":"https://github.com/szTheory/streakable","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/szTheory/streakable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szTheory%2Fstreakable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szTheory%2Fstreakable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szTheory%2Fstreakable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szTheory%2Fstreakable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/szTheory","download_url":"https://codeload.github.com/szTheory/streakable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szTheory%2Fstreakable/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264940379,"owners_count":23686242,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["calendar","mit-license","ruby","ruby-gem","ruby-on-rails","streak","streaks"],"created_at":"2024-09-30T15:53:14.991Z","updated_at":"2025-07-12T05:02:30.818Z","avatar_url":"https://github.com/szTheory.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Gem Version](https://badge.fury.io/rb/streakable.svg)](https://badge.fury.io/rb/streakable) [![Build Status](https://travis-ci.org/szTheory/streakable.svg?branch=master)](https://travis-ci.org/szTheory/streakable) [![Coverage Status](https://coveralls.io/repos/github/szTheory/streakable/badge.svg?branch=master)](https://coveralls.io/github/szTheory/streakable?branch=master) [![Inline docs](http://inch-ci.org/github/szTheory/streakable.svg?branch=master)](http://inch-ci.org/github/szTheory/streakable) [![Maintainability](https://api.codeclimate.com/v1/badges/cacc27fc37181c331918/maintainability)](https://codeclimate.com/github/szTheory/streakable/maintainability) [![MIT License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/szTheory/streakable/blob/master/LICENSE.txt) [![Gem](https://img.shields.io/gem/dt/streakable.svg)](https://rubygems.org/gems/streakable) [![GitHub stars](https://img.shields.io/github/stars/sztheory/streakable.svg?label=Stars\u0026style=social)](https://github.com/szTheory/streakable)\n\n![Streakable Logo](https://user-images.githubusercontent.com/28652/49296229-aa500a00-f485-11e8-8f13-51f2ad326e5c.png)\n\nStreakable is a Ruby gem to track consecutive day streaks :calendar: on your Rails/ActiveRecord models. Hard fork of [has_streak](https://github.com/garrettqmartin8/has_streak) by Garrett Martin with a different include interface and more features. Requires Ruby \u003e= 2.1 and ActiveRecord \u003e= 3.2.22.\n\n[Github Project Page](https://github.com/szTheory/streakable)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'streakable'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it directly with:\n\n    $ gem install streakable\n\n## Usage\n\nLet's say I have a \u003ccode\u003eUser\u003c/code\u003e that \u003ccode\u003ehas_many\u003c/code\u003e posts:\n\n```ruby\nclass User \u003c ActiveRecord::Base\n  has_many :posts\nend\n```\n\nI want to track how many days in a row that each user wrote a post. I just have to include \u003ccode\u003estreakable\u003c/code\u003e in the model:\n\n```ruby\nclass User \u003c ActiveRecord::Base\n  include Streakable\nend\n```\n\nNow I can display the user's streak:\n\n```ruby\nuser.streak(:posts) # =\u003e number of days in a row that this user wrote a post (as determined by the created_at column, by default)\n```\n\nThe \u003ccode\u003estreak\u003c/code\u003e instance method can be called with any association:\n\n```ruby\nuser.streak(:other_association)\n```\n\nAnd you can change the column the streak is calculated on:\n\n```ruby\nuser.streak(:posts, :updated_at)\n```\n\nDon't penalize the current day being absent when determining streaks (the User could write another Post before the day ends):\n\n```ruby\nuser.streak(:posts, except_today: true)\n```\n\nFind the longest streak, not just the current one:\n\n```ruby\nuser.streak(:posts, longest: true)\n```\n\nTo get all of the streaks, not just the current one:\n\n```ruby\nuser.streaks(:posts)\n```\n\n## TODO\n\n* Add class methods/scopes for calculating streaks on records not in memory\n\n## Specs\nTo run the specs for the currently running Ruby version, run `bundle install` and then `bundle exec rspec`. To run specs for every supported version of ActionPack, run `bundle exec appraisal install` and then `bundle exec appraisal rspec`.\n\n## Gem release\nMake sure the specs pass, bump the version number in streakable.gemspec, build the gem with `gem build streakable.gemspec`. Commit your changes and push to Github, then tag the commit with the current release number using Github's Releases interface (use the format vx.x.x, where x is the semantic version number). You can pull the latest tags to your local repo with `git pull --tags`. Finally, push the gem with `gem push streakable-version-number-here.gem`.\n\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b feature/my-new-feature`) or bugfix branch (`git checkout -b bugfix/my-helpful-bugfix`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin feature/my-new-feature`)\n5. Make sure specs are passing (`bundle exec rspec`)\n6. Create new Pull Request\n\n## License\n\nSee the [LICENSE](https://github.com/szTheory/streakable/blob/master/LICENSE.txt) file.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsztheory%2Fstreakable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsztheory%2Fstreakable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsztheory%2Fstreakable/lists"}