Ticket #750 (closed Defect: fixed)

Opened 10 years ago

Last modified 10 years ago

dm4-webclient: number types are persisted as string values..

Reported by: Malte Owned by: jri
Priority: Major Milestone:
Component: DeepaMehta Standard Distribution Version: 4.4
Keywords: Cc:
Complexity: 3 Area:
Module:

Description

Despite having set a "dm4.core.number" Data Type the webclient sends those topics values back to the REST API as numeric values wrapped in a string, consequently making neo4j initialize such values as of type String.

Making dm4-reviews compatible with 4.4 has brought up this issue again, see addOne() and substractOne() at the bottom of https://github.com/mukil/dm4-reviews/blob/master/src/main/java/org/deepamehta/plugins/review/ReviewPlugin.java

Hope this helps!

Change History

comment:1 Changed 10 years ago by jri

  • Status changed from new to accepted

Confirmed!

I broke serialization/storage of numbers in DM 4.2 (almost a year ago!) in this commit:
https://github.com/jri/deepamehta/commit/90546faecf258ff65b8a7f9cc342d71d1e302b36

In DM 4.1.3 it still worked correctly.

Thank you very much for reporting!

comment:2 Changed 10 years ago by Malte

BTW: It would be of great help if a patch for this would make up for a 4.4.2 and not force us to update to 4.5 to make use of numbers in the webclient.

Otherwise, it would be great if you can some infos here on how to fix/patch this issue in the dm4-webclient source code, since it is of matter in a new project i am currently working on.

Thanks & Cheers!

comment:3 Changed 10 years ago by jri

OK, I'll fix that nasty bug and release 4.4.2 very soon.
Thank you for insisting :-)

comment:4 Changed 10 years ago by Jörg Richter <jri@…>

In c4185114886423eb2b91602a14ff090f4f201c7c/deepamehta:

Webclient: fix number fields (#750).

The Webclient reads out input in "Number" fields properly as numbers.
As a consequence numbers are properly serialized (as JSON numbers) and stored/retrieved as numbers.
(Number handling was broken in DM 4.2 in the course of supporting aggregated Number child types.)

Note: numbers are also properly handled when choosen/entered from/in a combobox (when defined via aggregation).

Thank you, Malte, for reporting!

You can test it in the "number-fix" branch.
If it works for you I can release it as 4.4.2

Webclient API

1 new method in TopicType and AssociationType:

function is_number()

Returns true if the type's data type is "Number".

1 changed method:

dm4c.render.form_element(...)

It can also be used to render text areas.

1 changed method:

dm4c.render.form_element_function(form_element, page_model)

It takes a page_model as the 2nd parameter.

See #750.

comment:5 Changed 10 years ago by Jörg Richter <jri@…>

In 52891f5340bc90a790c350d935d63f731a4cda76/deepamehta:

Webclient: fix comboboxes (#750).

See #750.

comment:6 Changed 10 years ago by Malte

  • Status changed from accepted to closed
  • Resolution set to fixed

Just tested it and editing numbers via webclient are functional again! Thanks a lot!

Note: See TracTickets for help on using tickets.