mantenimento-app 2.4.3 → 2.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,6 +33,7 @@ function calculateModel(input) {
33
33
  const aFam1 = toNumber(input.aFam1);
34
34
  const aFam2 = toNumber(input.aFam2);
35
35
  const primaCasaMutuoEnabled = toNumber(input.primaCasaMutuoEnabled) > 0;
36
+ const primaCasaValoreLocativo = Math.max(0, toNumber(input.primaCasaValoreLocativo));
36
37
  const primaCasaMutuoImporto = Math.max(0, toNumber(input.primaCasaMutuoImporto));
37
38
  const primaCasaAssegnataA = String(input.primaCasaAssegnataA || '');
38
39
  const rawMutuoPerc1 = input.primaCasaMutuoPerc1 === undefined ? 50 : input.primaCasaMutuoPerc1;
@@ -121,13 +122,14 @@ function calculateModel(input) {
121
122
  if (aFam2 > 0.005) compensativeBenefits.push({ type: 'family', to: 2, amount: aFam2 });
122
123
  if (primaCasaTransfer1to2 > 0.005) compensativeBenefits.push({ type: 'primary-home-mortgage', from: 1, to: 2, amount: primaCasaTransfer1to2 });
123
124
  if (primaCasaTransfer2to1 > 0.005) compensativeBenefits.push({ type: 'primary-home-mortgage', from: 2, to: 1, amount: primaCasaTransfer2to1 });
125
+ if (primaCasaValoreLocativo > 0.005 && assigned !== '') compensativeBenefits.push({ type: 'primary-home-assignment', to: Number(assigned), amount: primaCasaValoreLocativo });
124
126
 
125
127
  const post1 = disp1 - assegnoDa1a2 + assegnoDa2a1;
126
128
  const post2 = disp2 - assegnoDa2a1 + assegnoDa1a2;
127
129
 
128
130
  // Separation cost analysis (only active when speseConvivenza > 0)
129
131
  const speseConvivenza = Math.max(0, toNumber(input.speseConvivenza));
130
- const housingIdx = new Set([0, 1, 2, 7]); // Affitto, casa/valore locativo, utenze, condominio
132
+ const housingIdx = new Set([0, 1, 6]); // Affitto, utenze, condominio
131
133
  const housingUtility1 = c1Spese.reduce((acc, n, idx) => acc + (housingIdx.has(idx) ? toNumber(n) : 0), 0) + quotaMutuoSpese1;
132
134
  const housingUtility2 = c2Spese.reduce((acc, n, idx) => acc + (housingIdx.has(idx) ? toNumber(n) : 0), 0) + quotaMutuoSpese2;
133
135
  const housingUtilityNonColl = collocatario === 1 ? housingUtility2 : housingUtility1;
@@ -161,7 +163,7 @@ function calculateModel(input) {
161
163
  quotaDiretta1, quotaDiretta2,
162
164
  saldo1, saldo2,
163
165
  assegnoBaseDa1a2, assegnoBaseDa2a1,
164
- primaCasaMutuoEnabled, primaCasaMutuoImporto,
166
+ primaCasaMutuoEnabled, primaCasaValoreLocativo, primaCasaMutuoImporto,
165
167
  primaCasaAssegnataA: assigned,
166
168
  primaCasaMutuoPerc1, primaCasaMutuoPerc2,
167
169
  primaCasaConsidered, primaCasaTransfer1to2, primaCasaTransfer2to1,
@@ -626,7 +626,7 @@
626
626
  <script src="supabase.min.js"></script>
627
627
  <script src="fabric.min.js"></script>
628
628
  <script src="html2pdf.bundle.min.js"></script>
629
- <script src="app.js?v=2.4.3"></script>
629
+ <script src="app.js?v=2.4.4"></script>
630
630
  </body>
631
631
  </html>
632
632
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mantenimento-app",
3
- "version": "2.4.3",
3
+ "version": "2.4.4",
4
4
  "description": "Frontend + backend architecture for the mantenimento calculator",
5
5
  "type": "commonjs",
6
6
  "main": "backend/calculate-model.js",