Compare commits
	
		
			No commits in common. "74f6e1ab69483d709aca781cb95e858c78a0d57f" and "aca4055d57459e3eefa1f5a45eed1e8476d66858" have entirely different histories.
		
	
	
		
			74f6e1ab69
			...
			aca4055d57
		
	
		
| @ -360,8 +360,7 @@ function App() { | |||||||
|           <Alert variant={'primary'}> |           <Alert variant={'primary'}> | ||||||
|             Poslední změny: |             Poslední změny: | ||||||
|             <ul> |             <ul> | ||||||
|               <li>Oprava parsování restaurace U Motlíků, pokud neexistuje nabídka pro první den v týdnu</li> |               <li>Tolerance existence menu na více týdnů pro restauraci U Motlíků</li> | ||||||
|               <li>Oprava parsování restaurace Sladovnická, pokud nabídka nezačíná pondělím</li> |  | ||||||
|             </ul> |             </ul> | ||||||
|           </Alert> |           </Alert> | ||||||
|           {dayIndex != null && |           {dayIndex != null && | ||||||
|  | |||||||
| @ -137,7 +137,7 @@ export const getMenuSladovnicka = async (firstDayOfWeek: Date, mock: boolean = f | |||||||
|                 isSoup: false, |                 isSoup: false, | ||||||
|             }); |             }); | ||||||
|         }) |         }) | ||||||
|         result[dayIndex] = currentDayFood; |         result[index] = currentDayFood; | ||||||
|     } |     } | ||||||
|     return result; |     return result; | ||||||
| } | } | ||||||
| @ -157,30 +157,23 @@ export const getMenuUMotliku = async (firstDayOfWeek: Date, mock: boolean = fals | |||||||
|     const html = await getHtml(U_MOTLIKU_URL); |     const html = await getHtml(U_MOTLIKU_URL); | ||||||
|     const $ = load(html); |     const $ = load(html); | ||||||
| 
 | 
 | ||||||
|     // Najdeme první tabulku, nad kterou je v H3 datum začínající co nejdřívějším dnem v aktuálním týdnu
 |     // Najdeme první tabulku, nad kterou je v H3 datum začínající prvním dnem aktuálního týdne
 | ||||||
|  |     // To může selhat mnoha způsoby, ale ty nemá cenu řešit dokud nenastanou
 | ||||||
|     const tables = $('table.table.table-hover.Xtable-striped'); |     const tables = $('table.table.table-hover.Xtable-striped'); | ||||||
|     let usedTable; |     let usedTable; | ||||||
|     let usedDate = new Date(firstDayOfWeek.getTime()); |     const firstDayOfWeekString = `${firstDayOfWeek.getDate()}.${firstDayOfWeek.getMonth() + 1}.`; | ||||||
|     for (let i = 0; i < 4; i++) { |  | ||||||
|         const dayOfWeekString = `${usedDate.getDate()}.${usedDate.getMonth() + 1}.`; |  | ||||||
|     for (const tableNode of tables) { |     for (const tableNode of tables) { | ||||||
|         const table = $(tableNode); |         const table = $(tableNode); | ||||||
|         const h3 = table.parent().prev(); |         const h3 = table.parent().prev(); | ||||||
|         const s1 = h3.text().split("-")[0].split("."); |         const s1 = h3.text().split("-")[0].split("."); | ||||||
|         const foundFirstDayString = `${s1[0]}.${s1[1]}.`; |         const foundFirstDayString = `${s1[0]}.${s1[1]}.`; | ||||||
|             if (foundFirstDayString === dayOfWeekString) { |         if (foundFirstDayString === firstDayOfWeekString) { | ||||||
|             usedTable = table; |             usedTable = table; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|         if (usedTable != null) { |  | ||||||
|             break; |  | ||||||
|         } |  | ||||||
|         usedDate.setDate(usedDate.getDate() + 1); |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     if (usedTable == null) { |     if (usedTable == null) { | ||||||
|         const firstDayOfWeekString = `${firstDayOfWeek.getDate()}.${firstDayOfWeek.getMonth() + 1}.`; |         throw Error(`Nepodařilo se najít tabulku pro datum ${firstDayOfWeekString}`); | ||||||
|         throw Error(`Nepodařilo se najít tabulku pro týden začínající ${firstDayOfWeekString}`); |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     const body = usedTable.children().first(); |     const body = usedTable.children().first(); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user