Aam-Digital / ndb-core

Easy-to-use case management web app for NGOs anywhere in the world.
http://www.aam-digital.com
GNU General Public License v3.0
58 stars 19 forks source link

Import: columns with numbers are not converted to string for importMapping lookups #2427

Open sleidig opened 4 months ago

sleidig commented 4 months ago

During imports a value is imported as number if it is all digits in the csv file. However, in our entities the related field may be a string. If such a field is used to map to an entity reference, the lookup in the EntityDatatype does not work anymore, as string and number equivalents of a value are not equal.


details for EntityDatatype.importMapFunction:

  /**
   * Maps a value from an import to an actual entity in the database by comparing the value with the given field of entities.
   * @param val The value from an import that should be mapped to an entity reference
   * @param schemaField The config defining details of the field that will hold the entity reference after mapping (e.g. specifying the entity type that can be linked here)
   * @param additional The field of the referenced entity that should be compared with the val
   */
  async importMapFunction(
    val: any,
    schemaField: EntitySchemaField,
    additional?: string,
  )
kumarannathan commented 1 week ago

Hi @sleidig! I’m interested in working on this issue as part of my EECS 481 class: https://web.eecs.umich.edu/~weimerw/481/hw6.html.
I’d like to enhance importMapFunction by adding types, jsDocs, and relevant unit tests. Let me know if there’s any guidance you’d recommend. Thanks!

sleidig commented 1 week ago

Hi @kumarannathan , thanks for reaching out and finding us! It's great to see your initiative to help our system - and thereby all our NGOs and social workers using Aam Digital :smiley:

Have you worked with Angular and TypeScript before and are familiar with unit tests written in jasmine? (sorry, many details!)

We'll be happy to guide you on the specifics of the Aam Digital code base and this concrete issue/task then.