Swag-for-dev: Suggestion: Don't remove items from data.json but set `active: false`

Created on 5 Oct 2018  ·  17Comments  ·  Source: swapagarwal/swag-for-dev

If an opportunity for free swag has expired, I suggest we don't remove the item from the data.json file. This will allow a user to browse through past opportunities and offers, some of which might even restart.

In light of that I propose either of the two implementations:

  1. If an item has expired, add an expired: true property to the item. Otherwise, set it to false.

  2. Divide the list into two portions: one with active opportunities and the other with expired/inactive ones.

good first issue ❔ question

Most helpful comment

I vote for the expired: true way of doing it. We would be able to filter swag opportunities from the gulp pipeline if we dont want them on the website.
Although i'm not sure expired is the best label, maybe active whould be better?

All 17 comments

I vote for the expired: true way of doing it. We would be able to filter swag opportunities from the gulp pipeline if we dont want them on the website.
Although i'm not sure expired is the best label, maybe active whould be better?

Agreed, active is better as inactive is more befitting.

+1 for active: true/false

Next Steps:

  1. Add active key in data.json
  2. Filter out inactive items in gulp pipeline

Seems straight-forward. Is there any newcomer that wants to work on this? We'll help you along the way! 😇

Hey, I'm new here, I would like to take up this issue, if I may. To confirm, I need to add the active key in each json object. Do I need to check whether the item is active and provide the correct value or just some default value?
I'm not familiar with gulp. Can you please guide me for filtering out inactive items from gulp pipeline?

Hi @sank20! As of now, all items listed in the data.json file are active, so adding active: true to all item objects is all you've got to do in respect to that.

Filtering of items is done client-side (as of now), the code of which is found here. The most convenient solution as of now is to add another filter (or incorporate it in the existing ones) that filters out items that have active set to false.

Thanks @plibither8! Cool, so I guess creating a new filter should ideally be a new issue that would be referenced to this one.

No need to create a separate issue, just create a new PR with the changes

Alright

@sank20 Let us know if you need any help!

@swapagarwal sure! I've been a bit busy with my office work lately, but I'll send the PR very soon.

Hey,I'm working on this issue.

Hi @rajeshwarirapelli25 ! Thanks for helping me for this as I'm gonna be super busy the whole month. Please note that you also need to add the filter for active/inactive items. Please refer the comments and feel free to ask your doubts here.

from @swapagarwal comment

Can think of adding something like validThru key to automatically make these inactive in November..

This would be great for all hacktoberfest events.

^ On the website, a warning can be added to items that are set to expire in a month or so. Something like:

  • active until 31st October
  • expiring on 31st October
  • expiring in 10 days

As hacktoberfest is over, we needed to filter out hacktoberfest swag, so #156 was merged. As part of this feature, we need to update the state of the hacktoberfest swag in the data file and remove the extra logic added to ./site/get-data.js

Rather than getting a new PR for _every_ hacktoberfest-related opportunity, could you remove the rest of the swag in this PR and place them in a new file (e.g. data-expired.json)?

_Originally posted by @vikaspotluri123 in https://github.com/swapagarwal/swag-for-dev/pull/154#issuecomment-435029535_

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jayzalowitz picture jayzalowitz  ·  6Comments

kevin51jiang picture kevin51jiang  ·  6Comments

plibither8 picture plibither8  ·  5Comments

aslafy-z picture aslafy-z  ·  6Comments

aslafy-z picture aslafy-z  ·  4Comments