steemcontest.com development update (Overcome adding contest links twice)

in hive-153176 •  3 years ago 

Screen Shot 2021-09-06 at 00.12.06.png

In recent days, we found a bug in our system. some of our users reported that there was a double contest on the main page of steemcontest.com. after we search it turns out that our system does not have a program to overcome the entry of links that have been entered once. So many of the same contests enter our database.

Based on this incident, our team worked to address this bug by creating a program to stop links that had already been entered again. So that when a link that has been entered is returned to our system, our system will issue a warning that the link has been entered before. You can see the results in the image above.

How does this system work?

When your link is entered in our system, our system will check whether the link already exists in our database system. our system will issue an alert that the link already exists in the system.

We put this program in the input link form, so when there is a change in the form. our system will immediately check whether the link is already in our database. If it already exists, then our system will issue a notification that the link has been added before.

How's the code?

onChangeLink(event){
          var link=event.target.value;
          if(link.startsWith('https://steemit.com/')){

            var db=firebase.firestore().collection('/contests').where('link', '==',event.target.value);
            db.get().then(contests=>{
                if(contests.docs.length>0){
                    this.setState({linkChek:true})
                    alert('link has added before')
                }else{
                    this.setState({linkChek:false})
                    this.setState({link:event.target.value})

                    var link1=link.split('https://steemit.com/')[1]
                    this.setState({permalink:link1.split('/')[2]})

                    var user=link1.split('/')[1];
                    this.setState({user:user.split('@')[1]})
                }
            })
            

           
          }else{
            this.setState({linkChek:true})
              
          }
      }
  • where('link', '==',event.target.value); Checking the link whether the link is already in the database
  • if(contests.docs.length>0) condition if there is already a link in the database
  • alert('link has added before') display a notification if the data already exists

Proof of work

You can check our commit here : https://github.com/sogatanco/steem-contest/commits/master

Screen Shot 2021-09-06 at 00.48.13.png

Can we get the program code from steemcontest.com ?

steemcontest.com is open source, so we provide every program code to the public. if you want to view, download, run our project on your local computer or you want to modify it. You can directly visit our github at: https://github.com/sogatanco/steem-contest

We really need your advice

In order to achieve the perfection of this project, we really hope for your suggestions. If you have an idea to add a feature on the steemcontest site, don't hesitate to contact us immediately. We really hope to make steemcontest.com more perfect in the future.

Kind Regards

@sogata / Steemcontest Dev

image.png

Our Other Project :

  • Bank STEEM : STEEM / SBD exchange site with IDR (Indonesian Rupiah), and vice versa.
  • Promosteem.Com :promosteem community tool to see the delegates and member status of the community
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Congratulations...!!! Your Post Selected As Top 8 Daily Post & Got Upvote 75%
By: PromoSteem Community

Alternative links delegates to @promosteem.com
50100200300400500
10002000300040005000
10000

image.png