Compare commits
	
		
			3 Commits
		
	
	
		
			a489f13d99
			...
			e71d9516ec
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| e71d9516ec | |||
| 658c10c2a4 | |||
| ff3defe52d | 
| @@ -173,6 +173,19 @@ namespace Elwig.Helpers { | ||||
|                 GROUP BY p.year, p.did, p.dpnr | ||||
|                 ORDER BY p.year, p.did, p.dpnr; | ||||
|                 """); | ||||
|  | ||||
|             ExecuteNonQuery(cnx, "DROP VIEW v_bucket"); | ||||
|             ExecuteNonQuery(cnx, """ | ||||
|                 CREATE VIEW v_delivery_bin AS | ||||
|                 SELECT year, mgnr, | ||||
|                        sortid || IIF(min_quw, REPLACE(COALESCE(attributes, ''), ',', ''), '_') AS bin, | ||||
|                        SUM(weight) AS weight | ||||
|                 FROM v_delivery | ||||
|                 GROUP BY year, mgnr, bin | ||||
|                 ORDER BY year, mgnr, LENGTH(bin) DESC, bin; | ||||
|                 """); | ||||
|  | ||||
|             ExecuteNonQuery(cnx, "ALTER TABLE wine_attribute ADD COLUMN fill_lower_bins INTEGER NOT NULL CHECK (fill_lower_bins IN (TRUE, FALSE)) DEFAULT FALSE"); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -154,7 +154,7 @@ namespace Elwig.Helpers.Billing { | ||||
|  | ||||
|         public static async Task<(Dictionary<string, int>, Dictionary<string, int>)> GetMemberRightsObligations(SqliteConnection cnx, int year, int mgnr) { | ||||
|             var members = await GetMemberRightsObligations(cnx, year, (int?)mgnr); | ||||
|             return members[mgnr]; | ||||
|             return members.GetValueOrDefault(mgnr, (new(), new())); | ||||
|         } | ||||
|  | ||||
|         public static async Task<Dictionary<string, int>> GetMemberBinWeights(int mgnr, int year, SqliteConnection cnx) { | ||||
| @@ -163,7 +163,7 @@ namespace Elwig.Helpers.Billing { | ||||
|             using var cmd = cnx.CreateCommand(); | ||||
|             cmd.CommandText = $""" | ||||
|                 SELECT bin, weight | ||||
|                 FROM v_bin | ||||
|                 FROM v_delivery_bin | ||||
|                 WHERE (year, mgnr) = ({year}, {mgnr}) | ||||
|                 """; | ||||
|  | ||||
|   | ||||
| @@ -13,6 +13,9 @@ namespace Elwig.Models { | ||||
|         [Column("max_kg_per_ha")] | ||||
|         public int? MaxKgPerHa { get; set; } | ||||
|  | ||||
|         [Column("fill_lower_bins")] | ||||
|         public bool FillLowerBins { get; set; } | ||||
|  | ||||
|         [Column("active")] | ||||
|         public bool IsActive { get; set; } | ||||
|         public override string ToString() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user