<commit_before>var eventViewModel;
var wantsToParticipate;

var emptyEvent = new function() {
    this.id = "";
    this.ename = "";
    this.date = "";
    this.time = "";
    this.place = "";
    this.account_id = "";
    this.fees = "";
    this.prize = "";
    this.description = "";
};

function EventModel(data)
{
    this.id = ko.observable(data.id);
    this.ename = ko.observable(data.ename);
    this.date = ko.observable(data.date);
    this.time = ko.observable(data.time);
    this.place = ko.observable(data.place);
    this.account_id = ko.observable(data.account_id);
    this.fees = ko.observable(data.fees);
    this.prize = ko.observable(data.prize);
    this.description = ko.observable(data.description);
    this.category = ko.observable(data.category);
    this.activity = ko.observable(data.activity);

    this.message = ko.observable('');
    
    this.participateVar=function()
    {
  wantsToParticipate=true;
  oldeventID = this.id(); 
    }
    this.DeleteEvent=function(){
          var self=this;
          $.delete("/events",
          {event_id : this.id()},
          function(data)
          {
              if(data.status == 'not_success')
              {
                   self.message("Event Cannot be Deleted");
              }
              else
              {
                   var oldevent = ko.utils.arrayFirst(eventViewModel.myEvents(),
                                                     function(item){
                                                         return item.id() == self.id(); 
                                                     });
                   eventViewModel.myEvents.remove(oldevent);
                   self.message("Event Deleted Successfully");
              }
          });
       
       };
    
    this.deleteParticipateEvent = function() {
   
          var self=this;
          $.delete("/participationEvent",
          {event_id : this.id()},
          function(data)
          {
              if(data.status == 'not_success')
              {
                   self.message("Event Cannot be Deleted");
              }
              else
              {
                   var oldevent = ko.utils.arrayFirst(eventViewModel.participationEvents(),
                                                     function(item){
                                                         return item.id() == self.id(); 
                                                     });
                   eventViewModel.participationEvents.remove(oldevent);
                   self.message("Event Deleted Successfully");
              }
          });
       
       };

    this.createEvent = function(event){
        var self = this;
        $.post('/createEvent',
               {event : event},
                function(data){
                    if(!data.error)
                    {
                        eventViewModel.message("Event Created Successfully");
                        eventViewModel.myEvents.push(self);
                    }
                    else
                    {
                         eventViewModel.message(data.error.message);
                    }
                }
                );
    }

}
function EventViewModel() {

    this.event = ko.observable({});
    this.createEventState = ko.observable(false);<commit_msg>added FE change to reflect the change in endpoint name for createEvent<commit_after>var eventViewModel;
var wantsToParticipate;

var emptyEvent = new function() {
    this.id = "";
    this.ename = "";
    this.date = "";
    this.time = "";
    this.place = "";
    this.account_id = "";
    this.fees = "";
    this.prize = "";
    this.description = "";
};

function EventModel(data)
{
    this.id = ko.observable(data.id);
    this.ename = ko.observable(data.ename);
    this.date = ko.observable(data.date);
    this.time = ko.observable(data.time);
    this.place = ko.observable(data.place);
    this.account_id = ko.observable(data.account_id);
    this.fees = ko.observable(data.fees);
    this.prize = ko.observable(data.prize);
    this.description = ko.observable(data.description);
    this.category = ko.observable(data.category);
    this.activity = ko.observable(data.activity);

    this.message = ko.observable('');
    
    this.participateVar=function()
    {
  wantsToParticipate=true;
  oldeventID = this.id(); 
    }
    this.DeleteEvent=function(){
          var self=this;
          $.delete("/events",
          {event_id : this.id()},
          function(data)
          {
              if(data.status == 'not_success')
              {
                   self.message("Event Cannot be Deleted");
              }
              else
              {
                   var oldevent = ko.utils.arrayFirst(eventViewModel.myEvents(),
                                                     function(item){
                                                         return item.id() == self.id(); 
                                                     });
                   eventViewModel.myEvents.remove(oldevent);
                   self.message("Event Deleted Successfully");
              }
          });
       
       };
    
    this.deleteParticipateEvent = function() {
   
          var self=this;
          $.delete("/participationEvent",
          {event_id : this.id()},
          function(data)
          {
              if(data.status == 'not_success')
              {
                   self.message("Event Cannot be Deleted");
              }
              else
              {
                   var oldevent = ko.utils.arrayFirst(eventViewModel.participationEvents(),
                                                     function(item){
                                                         return item.id() == self.id(); 
                                                     });
                   eventViewModel.participationEvents.remove(oldevent);
                   self.message("Event Deleted Successfully");
              }
          });
       
       };

    this.createEvent = function(event){
        var self = this;
        $.post('/events',
               {event : event},
                function(data){
                    if(!data.error)
                    {
                        eventViewModel.message("Event Created Successfully");
                        eventViewModel.myEvents.push(self);
                    }
                    else
                    {
                         eventViewModel.message(data.error.message);
                    }
                }
                );
    }

}
function EventViewModel() {

    this.event = ko.observable({});
    this.createEventState = ko.observable(false);
{'fraction_non_alphanumeric': 0.11509715994020926, 'fraction_numerical': 0.0, 'mean_word_length': 1.222923588039867, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3690727', 'n_tokens_mistral': 1696, 'n_tokens_neox': 1605, 'n_words': 254}