Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 15:58
    truckingsim commented #152
  • Jan 31 2019 15:16
    RomanRabirokh commented #152
  • Jan 31 2019 15:05
    jcrawford commented #152
  • Jan 31 2019 15:05
    jcrawford reopened #152
  • Jan 31 2019 15:05
    jcrawford commented #152
  • Jan 31 2019 14:48
    RomanRabirokh commented #152
  • Jan 31 2019 14:42
    jcrawford commented #152
  • Jan 31 2019 14:42
    jcrawford closed #152
  • Jan 31 2019 14:42
    jcrawford commented #152
  • Jan 31 2019 14:40
    RomanRabirokh commented #152
  • Jan 26 2019 07:36
    masteriii commented #163
  • Jan 24 2019 17:43
    truckingsim commented #163
  • Jan 24 2019 11:43
    masteriii edited #163
  • Jan 24 2019 11:40
    masteriii opened #163
  • Jan 20 2019 18:47
    Itay4 opened #162
  • Nov 28 2018 09:33
    agil-NUBBA closed #150
  • Nov 28 2018 09:33
    agil-NUBBA commented #150
  • Nov 28 2018 09:08
    reloxx13 commented #83
  • Nov 28 2018 08:46
    reloxx13 commented #83
  • Nov 28 2018 08:24
    reloxx13 commented #150
Mark Carver
@markcarver
yeah, I'm doing eslint now
Adam Heim
@truckingsim
if you do it just check it off in 114
Mark Carver
@markcarver
granted... via grunt :-/
yep
question
Adam Heim
@truckingsim
I wouldn't worry about shoving it into grunt for now
Mark Carver
@markcarver
if we're going to do webpack, will we need grunt?
Adam Heim
@truckingsim
I'm going to do everyting in my power to not need grunt
Mark Carver
@markcarver
well, the reason I'm doing it via grunt now is because that's how it's currently setup
it runs everything through grunt
Adam Heim
@truckingsim
yeah I nknow
I've been at work since 7:30 this morning, I have no intentions of staying late. I'm hoping I can get home and with it still being light out not tired and trying to work on revamping the build stuff.
Al Grant
@bigalnz
You there Adam?
Adam Heim
@truckingsim
@markcarver you around?
what do you think about how to deal with the old code before we've got everything done. We probably want to use the src/js/ folder for the new stuff.
Mark Carver
@markcarver
@truckingsim honestly, because we're not using LESS or SASS, we can just move the JS files to src
we don't need an extra "js" level
so we can leave the old stuff in JS until it's converted to es6 and placed directly in src
Adam Heim
@truckingsim
I can live with that
Al Grant
@bigalnz
Adam. you here?
Adam Heim
@truckingsim
@markcarver you around?
Al Grant
@bigalnz
Hey Adam - are you about for a question about the select?
@truckingsim ping
Adam Heim
@truckingsim
I am no guarantees on an answer though
Al Grant
@bigalnz
I had this code
// CODE FOR SELECT PICKER CODE DROP DOWN
function updatecodepicker() {
$('.stats:last .selectpicker').not('.stats-code-picker').selectpicker();
$('.stats-code-picker').selectpicker().ajaxSelectPicker({
ajax: {
url: '/offences',
dataType: 'json',
type: 'GET'
},
log: 4,
        preprocessData: function (data) {
            var offences = [];
            data.forEach(function (item) {
                offences.push({
                    value: item.code,
                    text: item.chargeText
                });
            });
            return offences;
        },
    })
}
ugh- lemme paste again
function updatecodepicker() {
    $('.stats:last .selectpicker').not('.stats-code-picker').selectpicker();
    $('.stats-code-picker').selectpicker().ajaxSelectPicker({
        ajax: {
            url: '/offences',
            dataType: 'json',
            type: 'GET'
        },
        log: 4,

        preprocessData: function (data) {
            var offences = [];
            data.forEach(function (item) {
                offences.push({
                    value: item.code,
                    text: item.chargeText
                });
            });
            return offences;
        },
    })
}
So its using a list of "code" objects
Actually I may be about to answer my own question here.

My code objects have
Id (native DB id)
Code : ie 1110
CodeText : ie Murder - Domestic

I should use the "Code" as my Db uniquie key since that number is unique - then I dont have to worry about two Codes/Id's

Adam Heim
@truckingsim
I mean you could sure, that's a DB question though, not a select question.
Al Grant
@bigalnz
yeah totally....
i just thought of it as I was typing to you
Adam Heim
@truckingsim
I prefer to have auto incrementing id's not tied to display data, but that's just me
I also come from a strict relational DB background.
not this willy nilly nosql stuff that's out there now.
Al Grant
@bigalnz
But what happens if you go to load a new copy of the code table and the Id's change - then it would screw up existing data?
Adam Heim
@truckingsim
I mean again that's an issue for the tooling, you would normally use a DB dump, or you would have schema data, which builds upon responses of things returned.
So it wouldn't matter the ID because it will just the one returned from the insert
schema data === scaffolding... like you wouldn't build everything at once, you build on top of the previous thing, which means you have id's returned from the inserts to work with.
or you use an ORM which handles all this for you
so yeah, that's a tooling problem
Al Grant
@bigalnz
So you would never change a given code's ID - if you need to update the table you only add to it, not empty and reload?
Adam Heim
@truckingsim
again just me, but for me id would be a auto incrementing primary key column. Code would be a unique integer or text (if codes are ever not numbers).
this way you can't insert a code more once
Al Grant
@bigalnz
right so the question is then a valid one for bootstrap-select. I need to return in the dropdown the "Charge Text" ie "Murder" and the ID "id" "4" which is the DB identifier
Adam Heim
@truckingsim
if you have other tables that rely on Code as in foreign Keys, you have 2 options, either make the foreign keys fail on delete or cascade on delete
Just change your value to item.Id
Al Grant
@bigalnz

So I just change:

        preprocessData: function (data) {
            var offences = [];
            data.forEach(function (item) {
                offences.push({
                    value: item.code,
                    text: item.chargeText
                });

to item.idCode